public ActionResult Edit(Visitors entity, HttpPostedFileBase ProfileImage) { if (ProfileImage != null && (ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/png")) { string filename = $"visitor_{entity.Kayit_No}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/Images/{filename}")); entity.Resim = filename; } if (ProfileImage == null && entity.Resim == null) { entity.Resim = "BaseUser.jpg"; } if (ModelState.IsValid) { var visitor = _visitorsService.GetById((int)entity.Kayit_No); if (visitor != null) { if (entity.ID != null) { entity.UseUserGroup = true; } else { entity.UseUserGroup = false; } _visitorsService.UpdateVisitor(entity); _accessDatasService.AddOperatorLog(321, permissionUser.Kullanici_Adi, entity.Kayit_No, 0, 0, 0); return(RedirectToAction("Index")); } } return(View(entity)); }
public ActionResult Edit(Visitors entity) { if (ModelState.IsValid) { var visitor = _visitorsService.GetById((int)entity.Kayit_No); var userVisitor = _userService.GetAllUsers().FirstOrDefault(x => x.Kart_ID == visitor.Kart_ID); if (visitor != null) { if (entity.ID != null) { entity.UseUserGroup = true; } else { entity.UseUserGroup = false; } _visitorsService.UpdateVisitor(entity); if (entity.Kart_ID != visitor.Kart_ID || entity.Grup_No != visitor.Grup_No) { Send(PanelListesi, CommandConstants.CMD_SND_USER, userVisitor.ID); } _accessDatasService.AddOperatorLog(321, permissionUser.Kullanici_Adi, entity.Kayit_No, 0, 0, 0); return(RedirectToAction("Index")); } } return(View(entity)); }