asp.net-mvc-5

Nuget dependency error installing RavenDb Embedded

喜你入骨 提交于 2019-12-02 23:39:07
I am trying to install RavenDB.Embedded in an ASP.NET MVC 5 application, but I have this dependency error: PM> Install-Package RavenDB.Embedded Attempting to resolve dependency 'RavenDB.Database (= 2.5.2750)'. Attempting to resolve dependency 'System.Spatial (≥ 5.2)'. Attempting to resolve dependency 'WindowsAzure.Storage (≥ 2.0)'. Attempting to resolve dependency 'Microsoft.WindowsAzure.ConfigurationManager (≥ 1.7.0.0)'. Attempting to resolve dependency 'Microsoft.Data.OData (≥ 5.0.2)'. Attempting to resolve dependency 'Microsoft.Data.Edm (= 5.0.2)'. Attempting to resolve dependency 'System

MVC 5 - two separate models on a page, how do I attach one to a form so I can submit it?

烈酒焚心 提交于 2019-12-02 23:10:03
问题 TL;DR: How do I handle form data that is being submitted with nonstandard names for the data? The stats: MVC 5 ASP.NET 4.5.2 I am bringing in two different models: public async Task<ActionResult> Index() { var prospectingId = new Guid(User.GetClaimValue("CWD-Prospect")); var cycleId = new Guid(User.GetClaimValue("CWD-Cycle")); var viewModel = new OnboardingViewModel(); viewModel.Prospecting = await db.Prospecting.FindAsync(prospectingId); viewModel.Cycle = await db.Cycle.FindAsync(cycleId);

Using $.ajax or $.post to call MVC 5 Controller method

廉价感情. 提交于 2019-12-02 23:01:00
问题 I'm trying to set up what should be a very simple call from an MVC page to a controller using JavaScript. This is my Controller: Imports System.Web.Mvc Namespace Controllers Public Class DataController Inherits Controller Function Index() As ActionResult Return View() End Function <HttpPost> Function SaveData(payload As String) As String If payload IsNot Nothing AndAlso payload.Length > 0 Then Return "Good" Else Return "Bad" End If End Function End Class End Namespace this is my View (Index

ASP MVC 5 Attribute routing VS. Convention-based routing

此生再无相见时 提交于 2019-12-02 22:35:51
ASP MVC 5 has a new Routing called attribute routing. The way I see it, the routes are now scattered on every controller unlike with the convention-based that there is single location RouteConfig.cs where you can check your routes, which also serves as documentation of your sites routes in some way. My question is it better to use Attribute routing over the convention-based routing in terms of readability and maintainability? And can someone suggest how to design routes for better maintainability and readibility. To address your first question, scattering the routes has a number of advantages:

ASP.Net MVC Angular 2 Final

夙愿已清 提交于 2019-12-02 22:20:34
Has anyone tried Angular 2 RC Final with ASP.Net MVC? I am having trouble with configuring Angular 2 RC 6 with ASP.Net MVC, till beta 17 everything was working fine. The package.json with below configuration doesn't seems to be working: "dependencies": { "@angular/common": "2.0.0-rc.6", "@angular/compiler": "2.0.0-rc.6", "@angular/core": "2.0.0-rc.6", "@angular/forms": "0.3.0", "@angular/http": "2.0.0-rc.6", "@angular/platform-browser": "2.0.0-rc.6", "@angular/platform-browser-dynamic": "2.0.0-rc.6", "@angular/router": "3.0.0-rc.1", "systemjs": "0.19.27", "core-js": "^2.4.0", "reflect-metadata

DateTime client-side validation fails due to formatting

拜拜、爱过 提交于 2019-12-02 22:08:26
问题 I'm using FluentValidation in an MVC5 project without any issues except for dates. My goal is to have GreaterThanOrEqualTo client-side validation working for a few date fields. I know that the current documentation doesn't list this method as supported client-side, but it renders the correct jQuery Validation data attributes. In my model, I have a property: [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)] [Display(Name = "Credit

Email confirmation in ASP.NET mvc5 without sendgrid

∥☆過路亽.° 提交于 2019-12-02 21:25:07
The title pretty much says it. Is there a way of adding Email Confirmation to my application without using the send grid ? my Azure account won't let me use it, says it isnt available in my zone and i cant seem to find another solution . Dudi I didn't use sendgrid neither in my website for the Email confirmation service. I See no point having it in small websites with low traffic. I use gmail SMTP service instead and it's works perfectly: using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Net.Mail; using System.Web; namespace MyProject

MVC5 Asp.net Is there a way to get the correct value from EditorFor for a subclass

给你一囗甜甜゛ 提交于 2019-12-02 21:22:33
问题 I have a class public class Citizen { public long ID { get; set; } public string Name { get; set; } public long CityID { get; set; } public string City { get; set; } public List<CitizenResource> Resources { get; set; } } I want to edit individual items in the Resources but the EditorFor doesn't set up the input correctly. @for (int i = 0; i < Model.Resources.Count; i++ ) { @Html.BeginForm("EditResource", "Citizen") { @Html.AntiForgeryToken() <div class="form-horizontal"> <div class="form

Cannot implicitly convert type system linq IQueryable to system collections generic List

半城伤御伤魂 提交于 2019-12-02 21:20:52
问题 Unable to fetch Data from View Model Controller to View,i have properly checked the working of query in LINQpad. However I am missing the conversion of the output of query which can be displayable in View. I have three Data Models Products,Images,Specifications which i combined into ViewModel with only selected properties and want to displaythe same. public class ViewModelController : Controller { private OMSEntities db = new OMSEntities(); // GET: ViewModel public ActionResult Index() { var

Understanding MVC-5 Identity

柔情痞子 提交于 2019-12-02 21:20:12
I created a new ASP.NET MVC-5 application with Individual User Accounts and then updated all the Nuget packages in the solution. Now I'm trying to follow some of the guidelines shown in some tutorials but I encountered some problems. The first one is that a class called ApplicationRoleManager which is being used throughout the application wasn't created (the ApplicationUserManager was created). The second problem is more about Entity-Framework : I've seen that for seeding the database with a user and role many people create a static constructor in the ApplicationDbContext class: static