private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtIncome.Text)) { lblMsg.Text = "Please enter details."; return; } IncomeHeadDto incomeHeadDto = new IncomeHeadDto { IncomeHeadName = txtIncome.Text, IncomeHeadDescription = txtDescription.Text, }; IncomeHeadViewModel incomeHeadViewModel = new IncomeHeadViewModel(); if (incomeHeadViewModel.InsertIncomeHead(incomeHeadDto)) { lblMsg.Text = "Successfully Saved"; txtIncome.Text = string.Empty; txtDescription.Text = string.Empty; } else { // lblMsg.ForeColor =; lblMsg.Text = "Unable to Save the Changes.Please fill ."; } }
public IEnumerable <IncomeHeadDto> GetAllIncomeHead() { IncomeHeadDto dto = new IncomeHeadDto(); var entities = repository.GetAll(); return(dto.ToObjects(entities)); }
public bool InsertIncomeHead(IncomeHeadDto incomeHeadDto) { try { repository.Insert(incomeHeadDto.ToEntity(incomeHeadDto)); return(true); } catch (Exception ex) { return(false); } }