No parameterless constructor defined for this object- Unable to Solve - c#

I am new to C# and MVC so please forgive any naiveness/stupidity. I have seen multiple posts dealing with the error I have and I have tried all the solutions but they dont seem to work in my case. Please guide me to the right way to solve this problem.
Background:
I have 2 models tblPrograms and tblReports.
I am trying to build a simple form where the user can create a new tblReport. Part of the process of creating a new tblReport is to select one tblProgram from a list.
Code Overview:
Controller:
// GET: /Reports/
public ViewResult New()
{
ProgramListModel progList = new ProgramListModel();
tblReports2 report = new tblReports2();
ExistingReportViewModel ervm = new ExistingReportViewModel(report,progList);
return View(ervm);
}
[HttpPost]
public ActionResult GenerateSQL(ExistingReportViewModel evrm)
{
evrm.Report.ProgramName = evrm.progList.selectedProgram;
return View(evrm);
}
View Model:
public class ExistingReportViewModel
{
public tblReports2 Report { get; set; }
public ProgramListModel progList { get; set; }
//public ExistingReportViewModel() { }
public ExistingReportViewModel(tblReports2 report, ProgramListModel progList)
{
this.Report = report;
this.progList = progList;
}
}
Models:
public class tblReports2
{
[Key]
public string ProgramName { get; set; }
public string ReportDesc { get; set; }
....
}
public class ProgramListModel
{
public SelectList progList;
public string selectedProgram;
public ProgramListModel() {
ReportHelper helper = new ReportHelper();
this.progList = helper.getProgramList();
}
}
Helper Method:
public SelectList getProgramList()
{
var programs = from p in this.DB.tblProgramsSet
select p;
programs = programs.Where(s => s.ProgramType.Equals("RPT"));
SelectList list = new SelectList(programs, "ProgramName", "ProgramDescription");
return list;
}
View:
#model ReportsSetup.Models.ExistingReportViewModel
#{
ViewBag.Title = "New";
}
New
#using (Html.BeginForm("GenerateSQL", "Reports"))
{
#Html.ValidationSummary(true)
<fieldset>
<legend>ExistingReportViewModel</legend>
#Html.DropDownListFor(model=>model.progList.selectedProgram, Model.progList.progList)
<div class="editor-label">
#Html.LabelFor(model => model.Report.ReportDesc)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Report.ReportDesc)
#Html.ValidationMessageFor(model => model.Report.ReportDesc)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Report.Formerly)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Report.Formerly)
#Html.ValidationMessageFor(model => model.Report.Formerly)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Report.ExtendedDesc)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Report.ExtendedDesc)
#Html.ValidationMessageFor(model => model.Report.ExtendedDesc)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Report.ReportCode)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Report.ReportCode)
#Html.ValidationMessageFor(model => model.Report.ReportCode)
</div>
...
<input type="submit" value="Create" />
</fieldset>
}
<div>
#Html.ActionLink("Back to List", "Index")
</div>
Error:
![Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.][1]
http://i.stack.imgur.com/GHJpG.jpg
Attempted Solutions:
Refactored the code to use IEnumerable <tblPrograms> instead of
SelectList in ProgramListModel and converting to
IEnumerable in View using a function similar to
sample below:
public static IEnumerable<SelectListItem> ToSelectListItems(
this IEnumerable<Album> albums, int selectedId)
{
return
albums.OrderBy(album => album.Name)
.Select(album =>
new SelectListItem
{
Selected = (album.ID == selectedId),
Text = album.Name,
Value = album.ID.ToString()
});
}
Refactored the code to use IEnumerable<SelectListItem> instead of
SelectList in ProgramListModel
Many Thanks in Advance!!

No, you can't do that:
public ActionResult GenerateSQL(ExistingReportViewModel evrm)
if your ExistingReportViewModel doesn't have a parameterless constructor. The default model binder doesn't know how to instantiate this class if it doesn't have a default constructor.
So you have 2 possibilities:
Define a parametrless constructor to this class:
public class ExistingReportViewModel
{
public ExistingReportViewModel()
{ }
... some other stuff of course
}
Write a custom model binder
Definitely go for 1. unless you need something very special. If you need something very special then please define it precisely, so that we can help you with 2.

Related

Display checkbox Data value from database using mvc

I need to create a form to register.
the example of form will look like this
how do I display the value in the red circle in the form? (the value is from database)
My controller
namespace Insurance.Controllers
{
public class FlexiPAController : Controller
{
//
// GET: /FlexiPA/
public ActionResult RegisterFlexiPA()
{
return View();
}
public ActionResult RegisterFire()
{
return View();
}
public ActionResult RegisterMotor()
{
return View();
}
}
}
My ViewModel
namespace Insurance.ViewModels
{
public class RegisterInfoPA
{
public register reg { get; set; }
public infoPA infoFlexiPA { get; set; }
public personalInfo pinfo { get; set; }
public List<maritalInfo> minfo { get; set; }
public childInfo cInfo { get; set; }
}
}
My view
#using (Html.BeginForm()) {
#Html.AntiForgeryToken()
#Html.ValidationSummary(true)
<!--TITLE-->
<div class="editor-label">
Title
</div>
<div class="editor-field">
#Html.EditorFor(model => model.reg.title)
#Html.ValidationMessageFor(model => model.reg.title)
</div>
<!--NAME-->
<div class="editor-label">
Name
</div>
<div class="editor-field">
#Html.EditorFor(model => model.reg.registerNm)
#Html.ValidationMessageFor(model => model.reg.registerNm)
</div>
<!--IC NO-->
<div class="editor-label">
IC No
</div>
<div class="editor-field">
#Html.EditorFor(model => model.reg.identityNo)
#Html.ValidationMessageFor(model => model.reg.identityNo)
</div>
<!--GENDER-->
<div class="editor-label">
Gender
</div>
<div class="editor-field">
#Html.EditorFor(model => model.pinfo.gender)
#Html.ValidationMessageFor(model => model.pinfo.gender)
</div>
<!--Marital Status-->
<div class="editor-label">
**Marital Status**
</div>
<div class="editor-field">
</div>
Wanted to make the checkbox here for marital status eg :single,widowed,married
I am new to mvc, really appreciate your helps.
Try this
Let's try one controller first
Your Controller
namespace Insurance.Controllers
{
public class FlexiPAController : Controller
{
//
// GET: /FlexiPA/
DATABASENAME db = new DATABSENAME (); //ESTABLISHING CONNECTION TO DATABASE
public ActionResult RegisterFlexiPA()
{
using (var dataBase = new DATABASENAME ())
{
var model = new RegisterInfoPA()
{
minfo = dataBase.maritalInfoes.ToList(),
//IF YOU WISH TO ADD MORE
};
return View(model);
}
}
Your ViewModel
change you marital info to IEnurumerable instead of List
public IEnumerable<maritalInfo> minfo { get; set; }
Your View
I would like to suggest you to make radiobutton instead of checkbox, because surely you can only choose one,eg: either single or married. Thus, it is highly preferred to use radiobutton
<div>
Marital Status
#foreach (var item in Model.minfo)
{
#Html.RadioButtonFor(model => model.pinfo.maritalId, item.maritalId)#Html.Label(item.maritalStatNm)
}
</div>
This is how you display, then in the controller you just need to save it.
You can use :
#foreach(var item in Model.minfo)
{
#Html.EditorFor(o => item)
}
Create a partial view called maritalInfo.cshtml. Put this partial in Views/Shared/DisplayTemplates.
In the partial :
#model maritalInfo
<!--Marital Status Name and Value depend on your maritalInfo Model-->
<div class="editor-label">
#Html.LabelFor(o => Model.Name)
</div>
<div class="editor-field">
#Html.CheckBoxFor(o => Model.Value)
</div>

MVC Razor EditorFor Last Object in List

I'm trying to display EditorFor for the last child Object in an collection. Below are the POCOs for the Order (Parent) and Hold (child collection):
public class Order
{
public int ID {get;set;}
public string Name {get;set;}
....
public virtual List<Hold> Holds { get; set; }
}
public class Hold
{
public int ID { get; set; }
public int OrderID { get; set; }
public virtual Order Order { get; set; }
public DateTime? When { get; set; }
public string Reason { get; set; }
}
Here's my attempt at creating an Order view that shows an Order and the last Hold if there is one present. I've commented out the last Hold attempt that doesn't work.
#model Order
#using (Html.BeginForm("Update", "Order", FormMethod.Post, new {}))
{
<div class="form-group row">
#Html.LabelFor(x => x.Name, new { #class = "col-xs-2" })
<div class="col-xs-10">
#Html.EditorFor(x => x.Name, new { #class = "form-control"})
</div>
</div>
<div class="form-group row">
<label class="col-xs-2">When</label>
<div class="col-xs-10">
#*#Html.EditorFor(x => x.Holds.Last().When, new {})*#
</div>
</div>
}
The Holds collection can also be null so doing Last() in that case will case an null exception even if that did work.
This seems like something simple and I have this pattern in a couple places in my database. Can anyone recommend a good way to handle this situation?
Thanks!
You should use a view model for this because you wont get a very good response in your HttpPost action when you post this back
public class OrderViewModel
{
public OrderViewModel()
{
Order = new Order();
Hold = new Hold();
}
public Order Order { get; set; }
public Hold Hold { get; set; }
}
public ActionResult Edit(int id)
{
var o = from o context.Order.Include("Holds").Single(id);
var model = new OrderViewModel()
{
Order = o
}
if (o.Holds.Count() > 0)
model.Hold = o.Holds.Last();
return View(model);
}
then just use EditorFors
#model OrderViewModel
#using (Html.BeginForm("Update", "Order", FormMethod.Post, new {}))
{
<div class="form-group row">
#Html.LabelFor(x => x.Order.Name, new { #class = "col-xs-2" })
<div class="col-xs-10">
#Html.EditorFor(x => x.Order.Name, new { #class = "form-control"})
</div>
</div>
<div class="form-group row">
<label class="col-xs-2>When</label>
<div class="col-xs-10">
#Html.EditorFor(x => x.Hold.When)
</div>
</div>
}
First, instead of using Last() you should use LastOrDefault() and then do proper null-checking. Last() raises an exception is nothing is found, while LastOrDefault simply returns null in that case.
Second, using Last() or LastOrDefault() will not generate the proper input names via EditorFor, so once you post, the modelbinder won't know what to do with the value. Instead, you need to use indexing:
#if (Model.Holds.Any())
{
var lastIndex = Model.Holds.Count() - 1;
<div class="form-group row">
<label class="col-xs-2">When</label>
<div class="col-xs-10">
#Html.EditorFor(x => x.Holds[lastIndex].When, new {})
</div>
</div>
}

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'PestType'

I am learning MVC and Entity Framework, so pleas bear my questions... I am trying to create a drop down menu for a property (Enum type) for my model class SinglePest
Here is the model:
public class SinglePest
{
public int SinglePestId { get; set; }
public PestType PestType { get; set; } // here is my problem
public string Alias { get; set; }
public string TechName { get; set; }
public string Markings { get; set; }
public string SerialNumber { get; set; }
public SourceType SourceType { get; set; }
//virtual property
public Source Source { get; set; }
}
Here is PestType:
public enum PestType
{
Dog,
Cat,
Fox,
Rabbit,
Rat
}
This is the controller:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create (//(SinglePest singlepest)
[Bind(Include= "Alias, TechName, SerialNumber, PestType, Markings")] SinglePest singlepest)
{
try
{
if (ModelState.IsValid)
{
db.SinglePests.Add(singlepest);
db.SaveChanges();
return RedirectToAction("Index");
}
}
catch (DataException /* dex */)
{
ModelState.AddModelError("", "Unable to save changes, try again, if problem persits contact your administrator");
}
//ViewBag.SerialNumber = new SelectList(db.Sources, "SerialNumber", "SerialNumber", singlepest.SerialNumber);
return View(singlepest);
}
And here is the View where I get the error (There is no ViewData item of type 'IEnumerable' that has the key 'PestType'.) :
<div class="editor-label">
#Html.LabelFor(model => model.PestType, "Pest Type")
</div>
<div class="editor-field">
#Html.DropDownList("PestType", String.Empty) // here is the error
#Html.ValidationMessageFor(model => model.PestType.ToString())
</div>
Now I have seen some posts about displaying enum, but I can't figure out a solution for my problem. Could please someone give me some piece of advice on how to fix it?
Thank you for your time!
You have #Html.DropDownList("PestType", String.Empty), but the second param needs to be an IEnumerable<T>. You will need the list of your pest in the model, and then use model.Pests for example where Pets is an IEnumerable.
EDIT: Based on comment...
But I want to display just the various types of pest (Dog, Cat, etc)
not all the pests that are in my database
OK, are these categorised, could you write something like (hand written so check syntax)..
var pests = (from _context.Pests.Where(p => p.CategoryId == 1) select p.PestName).ToList();
If you need to get a IEnumerable for the enum (since I'm not sure what the DB looks like), you can use...
Enum.GetValues(typeof(PestType))
.OfType<PestType>()
.Where(p => p == ??);
Currently your model only contains a place to store the value and not a Array/IEnumerable to populate the drop down from.
First add an IEnumerable to your model:
public class SinglePest
{
public int SinglePestId { get; set; }
public IEnumerable<PestType> Pests { get; set; }
public PestType PestType { get; set; }
public string Alias { get; set; }
public string TechName { get; set; }
public string Markings { get; set; }
public string SerialNumber { get; set; }
public SourceType SourceType { get; set; }
//virtual property
public Source Source { get; set; }
}
And in your controller:
public ActionResult Create()
{
var model = new SinglePest();
model.Pests = Enum.GetValues(typeof(PestType)).Cast<PestType>()
return View(model);
}
And your view:
#Html.DropDownListFor(m => m.PestType, Model.Pests);
Sorry if theres any errors I've written this from memory...
I found this post on DropDownListFor enums
It seems it is solving my problem.
so I have just changed the view with this new piece of code:
<div class="editor-label">
#Html.LabelFor(model => model.PestType, "Pest Type")
</div>
<div class="editor-field">
#Html.DropDownListFor(model => model.PestType, new SelectList(Enum.GetValues(typeof( MvcTrackingSystem.Enums.PestType))))
#Html.ValidationMessageFor(model => model.PestType)
</div>
Now it looks like it is working
On the difference between DropDownList and DropDownListFor I have found useful infromation on this post
You can fix the original problem quite simply with this in your GET Create method:
ViewBag.PestType = new SelectList(Enum.GetValues(typeof(PestType)).OfType<PestType>());
and this in your POST Create method (where validation fails and it returns the view):
ViewBag.PestType = new SelectList(Enum.GetValues(typeof(PestType)).OfType<PestType>(),
singlepest.PestType);
if you want to keep it strongly typed in the view use:
#Html.DropDownListFor(model => model.PestType, ViewBag.PestType as SelectList)
If you don't mind the weak typed version use the simpler:
#Html.DropDownList("PestType")
In either case I suggest you create all lists in the controller and not in the view.
Explanation:
Basically DropDownlist will search the ViewData (i.e. your ViewBag settings) for a list of options for the member of the same name (if a list is not explicitly provided).
I mocked up the whole project (MVC5/VS2013) and more of the code is below for your reference.
Controller:
using PestTypeTest.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace PestTypeTest.Controllers
{
public class PestTypeController : Controller
{
//
// GET: /PestType/
public ActionResult Index()
{
return RedirectToAction("Create");
}
public ActionResult Create()
{
ViewBag.PestType = new SelectList(Enum.GetValues(typeof(PestType)).OfType<PestType>());
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(//(SinglePest singlepest)
[Bind(Include = "Alias, TechName, SerialNumber, PestType, Markings")] SinglePest singlepest)
{
try
{
if (ModelState.IsValid)
{
//db.SinglePests.Add(singlepest);
//db.SaveChanges();
return RedirectToAction("Index");
}
}
catch (DataException /* dex */)
{
ModelState.AddModelError("", "Unable to save changes, try again, if problem persits contact your administrator");
}
//ViewBag.SerialNumber = new SelectList(db.Sources, "SerialNumber", "SerialNumber", singlepest.SerialNumber);
ViewBag.PestType = new SelectList(Enum.GetValues(typeof(PestType)).OfType<PestType>(), singlepest.PestType);
return View(singlepest);
}
}
}
Views\PestType\Create.cshtml
#model PestTypeTest.Models.SinglePest
#{
ViewBag.Title = "Create";
}
<h2>Create</h2>
#using (Html.BeginForm())
{
#Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>SinglePest</h4>
<hr />
#Html.ValidationSummary(true)
<div class="form-group">
#Html.LabelFor(model => model.PestType, new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.DropDownList("PestType")
#Html.ValidationMessageFor(model => model.PestType)
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.Alias, new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Alias)
#Html.ValidationMessageFor(model => model.Alias)
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.TechName, new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.TechName)
#Html.ValidationMessageFor(model => model.TechName)
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.Markings, new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Markings)
#Html.ValidationMessageFor(model => model.Markings)
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.SerialNumber, new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.SerialNumber)
#Html.ValidationMessageFor(model => model.SerialNumber)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
#Html.ActionLink("Back to List", "Index")
</div>
#section Scripts {
#Scripts.Render("~/bundles/jqueryval")
}

Passing part of a viewmodel to a controller

I have a Customer index page that takes a CustomerIndexViewModel to populate the page with a list of customers, the time the request took, and many other pieces of information.
I have a CustomerSearchArgsModel inside the CustomerIndexViewModel.
public class CustomerIndexViewModel : BaseIndexViewModel
{
public IEnumerable<Customer> Customers{ get; set; }
public double RequestTime { get; set; }
public CustomerSearchArgsModel CustomerSearchArgsModel { get; set; }
public OtherTypes OtherType {get;set;}
}
public class CustomerSearchArgsModel
{
public string CustomerID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
On my Customer Index page I want to have something like -
#model CustomerIndexViewModel
#{
ViewBag.Title = "Index";
}
<h2>Index</h2>
#using (Html.BeginForm("Index","Customer",FormMethod.Post, new { id="searchSubmit"}))
{
#Html.LabelFor(model => model.CustomerSearchArgsModel.ConsumerID)
#Html.EditorFor(model => model.CustomerSearchArgsModel.ConsumerID)
#Html.LabelFor(model => model.CustomerSearchArgsModel.LastName)
#Html.EditorFor(model => model.CustomerSearchArgsModel.LastName)
#Html.LabelFor(model => model.CustomerSearchArgsModel.FirstName)
#Html.EditorFor(model => model.CustomerSearchArgsModel.FirstName)
<input type="submit" value="Search" />
}
I want to return the typed in values to the Index (POST) method on the Customer controller in a CustomerSearchArgsModel.
But I don't know how to return a Model that is different from the one defined at the top of the page.
You can put your "searchSubmit" form inside a partial view. Then pass the model.CustomerSearchArgsModel to the partial view. Be sure that model.CustomerSearchArgsModel is not null; otherwise, you will get an exception.
Index Page
#Html.Partial("_search", model.CustomerSearchArgsModel)
_search Partial View
#model CustomerSearchArgsModel
#using (Html.BeginForm("Index","Customer",FormMethod.Post, new { id="searchSubmit"}))
{
#Html.LabelFor(model => model.ConsumerID)
#Html.EditorFor(model => model.ConsumerID)
#Html.LabelFor(model => model.LastName)
#Html.EditorFor(model => model.LastName)
#Html.LabelFor(model => model.FirstName)
#Html.EditorFor(model => model.FirstName)
<input type="submit" value="Search" />
}
The problem with this approach is you will get a 0 value displayed in your textbox for ConsumerID. To solve this problem you can use Html.Action instead of Html.Partial.
Hope this helps.

How to POST a form containing Editor Templates for an ICollection?

I'm working with ASP.NET MVC 4 and I have the following models:
public class MultiLanguageText
{
[Key] public int Id { get; set; }
[Required] public string Name { get; set; }
public virtual ICollection<LocalizedText> LocalizedTexts { get; set; }
}
public class LocalizedText
{
[Key] public int Id { get; set; }
[ForeignKey("Language")] public int LanguageId { get; set; }
public virtual Language Language { get; set; }
[ForeignKey("MultiLanguageText")] public int MultiLanguageTextId { get; set; }
public virtual MultiLanguageText MultiLanguageText { get; set; }
public string Text { get; set; }
}
I'm trying to create an Edit view for MultiLanguageText which will also contain an editor for every item in the LocalizedTexts property. The form goes like this:
#using (Html.BeginForm("Edit", "MultiLanguageText", FormMethod.Post)) {
#Html.ValidationSummary(true)
<fieldset>
<legend>MultiLanguageText</legend>
#Html.HiddenFor(model => model.Id)
<div class="editor-label">
#Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Name)
#Html.ValidationMessageFor(model => model.Name)
</div>
#Html.EditorFor(model => model.LocalizedTexts)
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
}
The editor template I've created (in the file ~/Views/Shared/EditorTemplates/LocalizedText.cshtml) is the following:
<fieldset>
<legend>LocalizedText</legend>
#Html.HiddenFor(model => model.Id)
<div class="editor-label">
#Html.LabelFor(model => model.LanguageId)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.LanguageId)
#Html.ValidationMessageFor(model => model.LanguageId)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.MultiLanguageTextId)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.MultiLanguageTextId)
#Html.ValidationMessageFor(model => model.MultiLanguageTextId)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Text)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Text)
#Html.ValidationMessageFor(model => model.Text)
</div>
</fieldset>
I'm testing with some pre-existing values and all the data is shown properly in the parent and in the child editors, when the page is shown. However, when I submit the form, all changes done inside any of the child editors are ignored.
My HttpPost method is this:
[HttpPost]
public ActionResult Edit(MultiLanguageText multilanguagetext)
{
if (ModelState.IsValid)
{
db.Entry(multilanguagetext).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(multilanguagetext);
}
My question is: How do I make it so that all values are posted, from both the parent model and its children model editors? (I've seen that other similar questions exist, but I've tried their solutions and they didn't seem to fix my problem.)
I'm testing your question. I think it's done and all values posted. But I think you need provide more information to fix your problem
After some trying, this is the solution that I found to work:
[HttpPost]
public ActionResult Edit(MultiLanguageText multilanguagetext)
{
if (ModelState.IsValid)
{
db.Entry(multilanguagetext).State = EntityState.Modified;
foreach (var local in multilanguagetext.LocalizedTexts) db.Entry(local).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(multilanguagetext);
}

Categories

Resources