public IActionResult Put([FromBody] TblRoleModel TblRoleModel) { try { var TblRole = _unitOfWork.tblRole.GetAll(); return(Ok(TblRole)); } catch (Exception ex) { Utilities.QuickLog($"Failed to TblRoleController, Function : Put() : {ex}"); return(Ok(ex)); } }
public IActionResult UpdateSizes(Guid id, [FromBody] TblRoleModel TblRoleModel) { if (ModelState.IsValid) { if (TblRoleModel == null) { return(BadRequest($"{nameof(TblRoleModel)} cannot be null")); } if (id != TblRoleModel.ID) { return(BadRequest("Conflicting Sizes id in parameter and model data")); } tblRole TblRole = _unitOfWork.tblRole.GetById(id); if (TblRole.Name != TblRoleModel.Name) { var Exist = _unitOfWork.tblRole.GetAll().Where(x => x.Name == TblRoleModel.Name).FirstOrDefault(); if (Exist != null) { var response1 = new { Success = false, Message = "TblRole Name already Exist.", }; return(Ok(response1)); } } if (TblRole == null) { return(NotFound(id)); } _imapper.Map <TblRoleModel, tblRole>(TblRoleModel, TblRole); try { _unitOfWork.tblRole.Update(TblRole); return(Ok()); } catch (Exception ex) { Utilities.QuickLog($"Failed to TblRoleController, Function :Put() : {ex}"); return(BadRequest("Error Occurred")); } } return(BadRequest(ModelState)); }
private void FrmCadUsuario_Load(object sender, EventArgs e) { List <TblEnderecoModel> listEndereco; TblEnderecoModel enderecoModel = new TblEnderecoModel(); listEndereco = enderecoModel.GetAll(); string endereco; foreach (var item in listEndereco) { idAddress = item.idAddress; street = item.street; number = item.number; codeZip = item.codeZip; neighborhood = item.neighborhood; city = item.city; nmState = item.nmState; endereco = idAddress + ", " + street + "-" + number + ", " + codeZip + ", " + neighborhood + ", " + city + ", " + nmState; cmbEndereco.Items.Add(endereco); } List <TblRoleModel> listRole; TblRoleModel roleModel = new TblRoleModel(); listRole = roleModel.GetAll(); foreach (var item in listRole) { string role; role = item.nmRole; cmbRole.Items.Add(role); } }