public void editUser(UserModels model, Guid ticket) { DataCommandService.IDataCommandService dataCommandService = new DataCommandService.DataCommandServiceClient(); DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var unit = dataQueryService.GetUnit(model.selectedUnitId, ticket); if (model.Password != null) { if (model.Password == model.repeatPassword) { DataCommandService.UserInfo user = new DataCommandService.UserInfo(); user.Id = model.id; user.Name = model.name; user.Surname = model.surname; user.Login = model.Login; user.IsAdmin = model.isAdmin; user.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password, "SHA1"); user.Unit = unitInfoConventer(unit); try { dataCommandService.AdminEditUsers(user, ticket); } catch (Exception ex) { } } } else { DataCommandService.UserEdit user = new DataCommandService.UserEdit(); user.Id = model.id; user.Name = model.name; user.Surname = model.surname; user.IsAdmin = model.isAdmin; user.Unit = unitInfoConventer(unit); try { dataCommandService.EditUsers(user, ticket); } catch (Exception ex) { } } }
public ActionResult UnitsEdit(int id) { if (Session["UserTicket"] != null) { DataQueryService.IDataQueryService dataQueryService = new DataQueryService.DataQueryServiceClient(); var unit = dataQueryService.GetUnit(id, new Guid(Session["UserTicket"].ToString())); UnitsModel model = new UnitsModel(); model.Id = unit.Id; model.Name = unit.Name; model.Description = unit.Description; return(View(model)); } return(Redirect("~/Login/Login")); }