public string Save(LeaveView leaveview) { var Leave = AutoMapper.Mapper.Map <Leave>(leaveview); if (string.IsNullOrEmpty(leaveview.AbsenceType)) { response.Message = "please Provide Absence Name"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } if ((leaveview.Days) == 0) { response.Message = "Calculate Dates"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } context.Leaves.Add(Leave); context.SaveChanges(); response.Message = "Record Save sucessfully!"; response.IsSuccess = true; return(JsonConvert.SerializeObject(response)); }
public string Save(AdminView adminview) { AdminView adminview1 = new AdminView(); adminview.Fname = "Abhi"; adminview.Lname = ""; var Admin = AutoMapper.Mapper.Map <Admin>(adminview); if (string.IsNullOrEmpty(adminview.Fname)) { response.Message = "Please provide type name"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } if (string.IsNullOrEmpty(adminview.Lname)) { response.Message = "Please provide type name"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } if (string.IsNullOrEmpty(adminview.Email)) { response.Message = "Please provide type name"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } if (string.IsNullOrEmpty(adminview.Designation)) { response.Message = "Please provide type name"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } if (string.IsNullOrEmpty(adminview.Gender)) { response.Message = "Please provide type name"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } if (context.Admins.Any(c => c.Email == adminview.Email)) { response.Message = "Please Provide Another Email id"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } context.Admins.Add(Admin); context.SaveChanges(); response.Message = "Record Save sucessfully!"; response.IsSuccess = true; return(JsonConvert.SerializeObject(response)); }
public string Save(AbsencenameView absencenameview) { var absencename = AutoMapper.Mapper.Map <Absencename>(absencenameview); if (string.IsNullOrEmpty(absencenameview.AbsenceType)) { response.Message = "Please provide type name"; response.IsSuccess = false; return(JsonConvert.SerializeObject(response)); } context.Absencenames.Add(absencename); context.SaveChanges(); response.Message = "Record Save sucessfully!"; response.IsSuccess = true; return(JsonConvert.SerializeObject(response)); }