private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtDeityName.Text)) { lblMsg.Text = "ദയവായി പ്രതിഷ്ടയുടെ പേര് ടൈപ്പ് ചെയ്യുക"; return; } DeityDto deityDto = new DeityDto { DeityName = txtDeityName.Text, Description = txtDescription.Text, IsMain = chkIsMain.Checked, }; if (deityViewModel.InsertDeity(deityDto)) { lblMsg.Text = "ചേർത്തിരിക്കുന്നു"; txtDeityName.Text = string.Empty; txtDescription.Text = string.Empty; chkIsMain.Checked = false; RefreshGrid(); } else { lblMsg.Text = "എന്തോ തകരാറു സംഭവിച്ചിരിക്കുന്നു"; txtDeityName.Focus(); } }
public IEnumerable <DeityDto> GetAllDeities() { DeityDto dto = new DeityDto(); var entities = repository.GetAll(); return(dto.ToObjects(entities)); }
public bool InsertDeity(DeityDto deityDto) { try { repository.Insert(deityDto.ToEntity(deityDto)); return(true); } catch (Exception ex) { return(false); } }