public ActionResult Update(int Id, string Adress, string Name, DateTime BirthDate, string Cellphone, string CEP, byte?Gender, int IdGroup, string Phone) { try { UserService.Update(new DAL.Users() { Id = Id, Adress = Adress, Name = Name, BirthDate = BirthDate, Cellphone = Cellphone, CEP = CEP, Gender = Gender, IdGroup = IdGroup, Phone = Phone }); InternalNotification.Success("User updated"); return(RedirectToAction("index")); } catch (Exception ex) { InternalNotification.Error(ex.Message); RedirectToAction("insert"); } return(RedirectToAction("index")); }
public ActionResult Create(string Groups, int Type, string Name, string Description, IEnumerable <HttpPostedFileBase> Files, DateTime BeginDate, DateTime EndDate, bool IsBroadcast = false, HttpPostedFileBase imageFile = null) { try { var IdsGroup = GetIdsFromString(Groups); var FilesDTO = GetFiles(Files); HttpFileStream imageFileStream = null; if (imageFile != null) { imageFileStream = new HttpFileStream() { InputStream = imageFile.InputStream, Name = imageFile.FileName }; } ContentService.CreateContent(IdsGroup, null, Type, Name, Description, FilesDTO, BeginDate, EndDate, IsBroadcast, imageFileStream); InternalNotification.Success("Material Created"); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Delete(int Id) { try { GroupService.Delete(Id); InternalNotification.Success("Group Deleted"); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Update(int Id, string Name, bool IsActive = false) { try { GroupService.Update(Id, Name, IsActive); InternalNotification.Success("Group updated"); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Edit(int Id) { try { var Group = GroupService.Find(Id); return(View(Group)); } catch (Exception ex) { InternalNotification.Error(ex); return(RedirectToAction("index")); } }
public ActionResult Delete(int Id) { try { var Deleted = UserService.Delete(Id); InternalNotification.Success("User deleted"); } catch (Exception ex) { InternalNotification.Error(ex.Message); } return(RedirectToAction("index")); }
public ActionResult Insert() { try { ViewBag.Groups = GroupService.GetAll().Where(x => x.Active); return(View()); } catch (Exception ex) { InternalNotification.Error(ex); return(RedirectToAction("index")); } }
public ActionResult ResendActivationEmail(string Email) { try { UserService.ResendActiveEmail(Email, GetActiveEndPoint()); InternalNotification.Success("The email was sent"); } catch (Exception ex) { InternalNotification.Error(ex.Message); } return(RedirectToAction("index")); }
public ActionResult Update(DAL.Genres genre, int id) { try { genreService.Update(id, genre); InternalNotification.Success("Genre updated"); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Edit(int Id) { try { var genre = genreService.Find(Id); ViewBag.Parents = genreService.GetAll(); return(View(genre)); } catch (Exception ex) { InternalNotification.Error(ex); return(RedirectToAction("index")); } }
public ActionResult Delete(int Id) { try { ContentService.Delete(Id); string Message = "Material deleted"; InternalNotification.Success(Message); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Delete(int Id) { try { var genre = genreService.Find(Id); genreService.Delete(genre); InternalNotification.Success("Genre Deleted"); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Create(string Name) { try { GroupService.Create(Name); string Message = "Group Created"; InternalNotification.Success(Message); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Create(string name, int?idParent) { try { genreService.Create(name, idParent); string Message = "Genre Created"; InternalNotification.Success(Message); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Update(int Id, string Groups, string Name, string Description, IEnumerable <HttpPostedFileBase> Files, DateTime BeginDate, DateTime EndDate, bool IsBroadcast = false) { try { var IdsGroup = GetIdsFromString(Groups); var idsTypes = GetIdsFromString(Groups); var FilesDTO = GetFiles(Files); ContentService.UpdateContent(Id, IdsGroup, idsTypes, Name, Description, FilesDTO, BeginDate, EndDate, IsBroadcast); InternalNotification.Success("Material Updated"); } catch (Exception ex) { InternalNotification.Error(ex); } return(RedirectToAction("index")); }
public ActionResult Insert() { try { var Groups = GroupService.GetAll().Where(x => x.Active == true); var JsonSettings = new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; ViewBag.Groups = JsonConvert.SerializeObject(Groups, JsonSettings); return(View()); } catch (Exception ex) { InternalNotification.Error(ex); return(RedirectToAction("index")); } }
public ActionResult Edit(int Id) { try { var Content = ContentService.Find(Id); var Groups = GroupService.GetAll().Where(x => x.Active == true); var SelectedGroupIds = Content.GroupContents.Select(x => x.IdGroup); var JsonSettings = new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; ViewBag.Groups = JsonConvert.SerializeObject(Groups, JsonSettings); ViewBag.SelectedGroupIds = JsonConvert.SerializeObject(SelectedGroupIds, JsonSettings); return(View(Content)); } catch (Exception ex) { InternalNotification.Error(ex); return(RedirectToAction("index")); } }
public ActionResult Create(string Adress, string Name, DateTime BirthDate, string Cellphone, string CEP, string CPF, string Email, byte?Gender, int IdGroup, string Phone, string Password, string PasswordConfirmation) { if (Password != PasswordConfirmation) { InternalNotification.Error("Password does not match"); RedirectToAction("insert"); } try { var CreatedId = UserService.Create(new DAL.Users() { Name = Name, Adress = Adress, BirthDate = BirthDate, Cellphone = Cellphone, CEP = CEP, CPF = CPF, Email = Email, Gender = Gender, IdGroup = IdGroup, Phone = Phone }, Password, GetActiveEndPoint()); if (CreatedId < 1) { throw new Exception("Could not Create User"); } //InternalNotification.Success("User created"); return(RedirectToAction("UserCreated", "Home")); } catch (Exception) { InternalNotification.Error("Ocorreu um erro inesperado, por favor tente mais tarde"); return(RedirectToAction("insert")); } }