Questions tagged [model-view-controller]

0

votes
0

answer
10

Views

how can ı get role of admin in users?

public class MembershipTools{ private static MyContext _db; public static UserStore NewUserStore() => new UserStore(_db ?? new MyContext()); public static UserManager NewUserManager() => new UserManager(NewUserStore()); public static RoleStore NewRoleStore() => new RoleStore(_db ?? new MyContext());...
Alper Gök
1

votes
1

answer
1.9k

Views

MVC ignoring .jpg file extension on certain route — Use Controller action?

I'm trying to serve image files from a specific url system, like so: mysite/Images/Category/File_Name.extension I've set up a route like so: routes.MapRoute( "ImagesRoute", // Route name "Images/{category}/{file}.jpg", // URL with parameters new { controller = "Posts", action = "ViewImage", cate...
Sarah Bailey
-1

votes
0

answer
6

Views

How to obtain a list of people with the WEB API. Use of dependency injection (SOA architecture)

I'm trying to return a list of people With the WEB API but I did not succeed .I'm using dependency injection (SOA architecture) Error. The type 'ObjectContent`1' could not serialize the response body for the content type application / xml; set of characters = utf-8 '. System.InvalidOperationExcepti...
Maurico Bello
0

votes
1

answer
55

Views

checked property of a radio button not binding to boolean property of a model

Below is i have radio button set up. I have Configuration as group name, and i have 4 different radio buttons in this group which have different selectionId and i bound 3rd option which is checked property to Boolean Selection. I am able to bind checked property to selection from database when i do...
rampantNinja
0

votes
0

answer
10

Views

How to set two models in single view in MVC 5 C#?

I am new to MVC framework. I saw some of the links of stack overflow, but I didn't get the point. I tried the below code, could anyone what's wrong with that?. I create 3 models 1.SignIn.cs public class SignIn { public string userName { get; set; } public string password { get; set; } public string...
Liam neesan
1

votes
4

answer
597

Views

How to find a record by id and select few columns, ruby on rails?

I have a User model that has all the queried fields with the existing data in the database. When I execute the following query- @user = User.find(4, :select => 'user_fname, user_lname') Rails throws the following error for the above line Couldn't find all Users with 'user_id': (4, {:select=>"user_fn...
wolf3D
0

votes
0

answer
11

Views

C# Mvc Entity Framework Stackoverflow exception

I am trying to add 4000 rows at My contexts seed method. But I got StackOverflow exception. When debugging I cannot determine the error point. After googling I found here that StackOverflow exception is a limited memory issue. Then I have considered using Garbage collector But here says you can but...
Tekin Güllü
0

votes
0

answer
7

Views

how to set focus in mvc layout for specific page

the following 3 links are in my layout page i am trying to create a focus element for the item class when i use CSS, each time the layout page is refreshed with the link and the element looses its focus @Html.ActionLink("Home","Index","Home",new{area=""},new {@class="item"}) @Html.ActionLink("Abo...
kushal
0

votes
2

answer
55

Views

trying to secure website but also keep Home (index) page public MCV5 asp.net identity

I have a site with a few pages and I implemented login and register. then I implemented SSL and added redirects for anyone trying to access the site without HTTPS with the following code: first I changed the project to only allow SSL HTTPS in project settings GLOBAL ASAX protected void Application...
Moi Hawk
1

votes
2

answer
184

Views

How to host multiple apps on one Azure Web App

i built app (ASP .NET Core MVC + Angular). I need to deploy this app for three different customers. Each customer at this moment have its own database. Is it possible to have multiple sites inside one azure web app (like mysite.com/a, mysite.com/b and mysite.com/c) and each of these sites to have it...
David Kron
1

votes
2

answer
27

Views

Chrome keeps auto scrolling my mvc view to top

I am facing an issue in my MVC project that when I run it in Chrome, Chrome keeps auto scrolling it to top. I need to disable it or handle it to ot scroll. The chrome version I am using is 70.0.3538.110. Here is the piece of code I am using to forcefully scroll to bottom: domElement.scrollTop = dom...
Gurpreet Singh Drish
1

votes
1

answer
79

Views

How do I separate model and view in ipywidgets?

Consider the example of a simple foreign exchange calculator app. I can define my model using traitlets: from traitlets import HasTraits, Float, observe, Enum import math class FXModel(HasTraits): domestic_qty = Float() foreign_qty = Float() fx_rate = Float(float('nan')) # in units of domestic_qty/...
user357269
0

votes
0

answer
11

Views

How to Implement Spring security in Spring MVC application?

I'm new to Spring security. I have implemented spring security and have generated the JWT token. Now i need to get the user from the token and set it in the session so that the session for that user maintains until the token expires or logged out. On the other hand i need to access the API's from t...
0

votes
1

answer
6

Views

Can a _Layout.cshtml have a controller

I want to add navigation from database in _Layout.cshtml. I've created a controller for this and create _Layout.cshtml as a list view but its not working This is my view code @model IEnumerable @ViewBag.Title - My ASP.NET Application @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/moderni...
Owais Bin Rizwan
0

votes
0

answer
3

Views

Missing required keys: [:id] - Routing to a view for each instance of my model with its unique ID

I'm working on a job board to learn/practice rails. I have a separate view for each job category, and I want the user to be able to click on a particular job posting to access another view with all of the listing's details. I've partially figured out the routing, as I'm able to go to localhost:3000/...
user2570506
1

votes
4

answer
134

Views

Application where user inputs month number 1-12 and http post returns month name isn't working

I have an application that asks the user to input a number 1-12 in a form field. Upon hitting a submit button they should be returned to the http post which tells them the corresponding month. EXAMPLE: if the user inputs '9' the http post SHOULD read "the month you chose is 'September' As of now, t...
HerbalChaos420
1

votes
1

answer
1.1k

Views

how to add phone number field in registeration page of mvc application

i want to add phone number field on default registration page of MVC5 Web Application. and when a user register with given info the user data store in default database of AspNetUsers table in PhoneNumber column. here is my code for register View. @Html.ValidationSummary("", new { @class = "text-dang...
Basharat Ali
0

votes
0

answer
16

Views

Move selected items from listbox1 to listbox2, problem to save to db

I have a big problem. Right now im using two listboxes, the first one contains all users from the database. The second listbox will be able to store selected users. The idea is that im gonna create a meeting, and invite specific users who will be inserted in a table to the specific meeting. Im going...
CharlieV2
1

votes
1

answer
813

Views

Prevent Access to Partial View from URL but not from Ajax Call [duplicate]

This question already has an answer here: Is there any attribute relating to AJAX to be set for ASP.NET MVC controller actions? 6 answers I wrote few partial methods in my controller and it is accessing directly typing in url. I want to restrict those particular methods.I used [ChildActionOnly] Att...
Praveen Kumar
1

votes
2

answer
41

Views

Nodejs, is better have a lot of same require or use a handle?

Image this esctructure: - app.js - core/ - service_1.js - service_2.js - service_3.js - service_4.js - service_5.js - modules/ - module_1.js - module_2.js - module_3.js The app.js uses the 3 modules, so the code of the app is: var m1 = require('./modules/module_1'); var m2 = require('./modules/modu...
jtwalters
1

votes
3

answer
1.7k

Views

Scrollbar style on datatable

How can i style a specific datatable scorllbar with webkit. Here is the code: id ::-webkit-scrollbar-track { background-color: transparent; border-radius: 5px; } id::-webkit-scrollbar { width: 13px; } id::-webkit-scrollbar-thumb { border-radius: 5px; height:40%; background-color: #999999; but this s...
Mihai
0

votes
1

answer
21

Views

The searched words are not registered correctly in my database

I am trying to register in my database, the words that the user searches on my website. The idea is the following: If the searched word matches one already registered in my database, I simply add 1 to the number of times the word was searched. If the word is not found in my search table, I add a new...
John J.
1

votes
1

answer
294

Views

CS cart:How to override currencies.tpl file

I am using CS cart version 4.4.3. I want to change the template structure as well as design of currencies.tpl file. How can I do that, so that in future updates override file will not change? Currently file is located at:- design\themes\responsive\templates\blocks I have tried to override it via p...
Developer Status
0

votes
0

answer
8

Views

How to transfer a list or array to a controller using a model in a view?

Using the model, I need to transfer form data from view to controller. @model EditFormApplication.Models.NewForm @using (Html.BeginForm("EditForm", "Home", FormMethod.Post)) @Html.EditorFor(model => model.HeadForm) @Html.EditorFor(model => model.HeadField) The "Add Field" button adds another div cla...
0

votes
0

answer
5

Views

How to assign TextField Delegate and methods when creating reusable views

I am trying to create a reusable UI Component within my app, this particular component contains a UITextFeild. I have successfully set up the text field in the view and it displays perfectly, however... The text fields delegate setup doesn't work. I have tried referencing the text field from the cr...
Mark Brown
1

votes
2

answer
458

Views

Laravel 5 Controller Best Practices

I'm using Lumen as REST API. I have a Post model and a Comment Model. Post.php public function comments(){ return $this->hasMany('App\Comment'); } Comment.php public function post(){ return $this->belongsTo('App\Post'); } I also have Resource controllers for both these models. If I want to get all...
Sk Golam Saroar
1

votes
1

answer
60

Views

How are Sylius Admin Controllers Restricted to Admin Users

When working in a traditional (or more accurately, some traditional) PHP MVC systems, if an application has an "admin" area that requires users to login to the application, a programmer will either use a controller class that inherits from some base admin controller, or uses some admin trait. The ro...
Alan Storm
1

votes
1

answer
71

Views

What is throwing IOException here?

I am trying to take data from a GUI and also from arraylists in my model class and then want to put them into another arraylist. Everytime the code runs, it works fine but then when I close the application and the serializer code runs the IOException gets thrown. The only thing I access from the mo...
Top Lit
1

votes
2

answer
61

Views

Calling ajax request from asp.net razor view

How do I initiate an ajax request (calling controller action) from razor view which returns the data in JSON format? At the moment after clicking the action link in my razor view the page does the post request which redirects the page to /actionName which of course does not exist. I am also using...
zaq
1

votes
2

answer
193

Views

PHP - Structuring a Slim3 web application using MVC and understanding the role of the model

I’m trying to create an authentication system in php with the Slim3 framework along with the Twig template system, and for the database I’m using MySQL with PDO. I’m also trying to implement it using a model view controller design pattern. However I’m having difficulty understanding how to u...
GR412
0

votes
1

answer
20

Views

how can get an object instead of array like FETCH_OBJECT instead of FETCH_ASSOC

I have a class names Product.php in my model directory. in my view directory, I have an index.php currently I fetching data out of my table using this function the code works fine but I want to field $row['name'] to be called as an object. because I am not sure the way I'm doing is a semantically...
ali
1

votes
2

answer
184

Views

Structures of Complex and enterprise level applications [closed]

I have a problem about structures of the complex applications. Because my knowledge background does not come from education, I have always had a problem understanding an application's layers, design patterns, and programing structures. First of all, I can do whatever I want with PHP, because I know...
Oguz Bilgic
0

votes
0

answer
14

Views

While am adding row using add row drop down is not binding in recently add rows

am trying to bind dropdown through api while user add row the drop is bind but its not showing on first row that user add while on other row dropdown is display also am binding drop down item but it not select the value of specific item $(document).ready(function () { var counter = 0; $("#addrow").o...
Ayesha Rafiq
0

votes
0

answer
3

Views

How to show all country as well as multiple select in mvc

actually, I needed all country show in autocomplete dropdown also multiple select in MVC
Deepak Behera
0

votes
0

answer
5

Views

How to get two actions in one step

Right now, I have I have an index.cshtml that has a html.actionLink to bring a preview of a html table that pulls data out of the form to get ready to print it. Then when I click the link, it goes to a preview of the PDFOnePage.cshtml with an html. Then there's a button to get it to the abcpdf met...
Michele
1

votes
1

answer
29

Views

How to pass multiple checkbox parameters from foreach

I have a form in my View with a table and on each cell i have a checkbox. I already have individual Ids for every single checkbox but I dont know how to pass them individually to controller action. I know how to pass single parameters over the "name" attribute but Im not sure on how to handle it wit...
Mischa Morf
1

votes
1

answer
403

Views

node.js express mvc method name in variable

I have a problem to give a name to a controller to load my models: my app.js var express = require('express'); var app = express(); app.everyauth = require('everyauth'); app.mongoose = require('mongoose'); var fs = require('fs'); var config = require('./config.js')(app, express); //Include models va...
Ajouve
1

votes
1

answer
457

Views

Spring, how to manage HTTP Request by headers?

In this period I am studing the Spring MVC Showcase example dowlodable from the STS dashboard I have a doubt related to the functioning of the HTTP Request mapping by header. In the showcase example I have the following 2 links: By presence of header By absence of header So, as you can see, clicking...
AndreaNobili
1

votes
1

answer
80

Views

Ember-Data - Reach Object from Router to Controller

If I do in my router: connectOutlets: function(router, context){ router.set('objectController.fooObject', App.get("session.sessionObject")); } How to get this object in my controller? If I initialize it with object = null, I can get its attributes with handlebars like this: {{object.bar}} But cant...
Robin Wieruch
1

votes
1

answer
232

Views

Using Ember.js, where should the logic for processing the request and then adding a new child divs sit?

Let's say the user might pick one div from the set { A, B, C } and add it to div X, except each div has a different rule that may be dependent the application state and some intrinsic property of each div. Finally upon adding the div, each div might trigger different events. for example, in one appl...
chibro2

View additional questions