Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IEnumerable<MvcInternetShop.Models.DomainModels.Group> Groups { get; set; }
- public MvcInternetShop.Models.DomainModels.Group Group { get; set; }
- public ActionResult AddGroup(Group model)
- {
- if (ModelState.IsValid)
- {
- if (gr.Add(model)) // gr is a GroupRepository for CRUD.
- return JavaScript("notif({type: 'info',msg: 'Your Group Registerd.',width: 'all',height: 100,position: 'center'});");
- else
- return JavaScript("notif({type: 'error',msg: 'Error.Try again!.',width: 'all',height: 100,position: 'center'});");
- }
- else
- {
- return JavaScript("notif({type: 'error',msg: '" + ModelState.GetErrors() + "',width: 'all',height: 100,position: 'center',modal:true});");//GetError() is a myExtension method.
- }
- }
- @using (Ajax.BeginForm("AddGroup", "Admin", new AjaxOptions { HttpMethod="Post",Url="/Admin/AddGroup"}))
- {
- @Html.TextBoxFor(p=>Model.Group.Name)//Model is a viewmodel that contains Group and Groups property.
- @Html.ValidationMessageFor(p => Model.Group.Name)
- <button type="submit" class="button">Add group</button>}
Add Comment
Please, Sign In to add comment