public JsonResult Insert([FromBody] MandatoryInformation item) { if (item != null) { try { MandatoryInformation MandatoryInfo = new MandatoryInformation { Name = item.Name, Addres = item.Addres, Email = item.Email, Phone = item.Phone, Comments = item.Comments }; var insertedItem = _context.Add <MandatoryInformation>(MandatoryInfo); _context.SaveChanges(); return(Json(insertedItem.Entity)); } catch (Exception e) { return(Json(e.Message)); } } return(Json("Error")); }
public JsonResult Insert([FromBody] User item) { if (item != null) { try { User MandatoryInfo = new User { Name = item.Name, Mobile = item.Mobile, Male = item.Male, DepatmentId = item.DepatmentId, UserName = item.UserName, Password = item.Password, IsAdmin = item.IsAdmin }; var insertedItem = _context.Add <User>(MandatoryInfo); _context.SaveChanges(); return(Json(insertedItem.Entity)); } catch (Exception e) { return(Json(e.Message)); } } return(Json("Error")); }
public JsonResult Insert([FromBody] Contact item) { if (item != null) { try { Contact MandatoryInfo = new Contact { Name = item.Name, Role = item.Role, Phone = item.Phone, Mail = item.Mail }; var insertedItem = _context.Add <Contact>(MandatoryInfo); _context.SaveChanges(); return(Json(insertedItem.Entity)); } catch (Exception e) { return(Json(e.Message)); } } return(Json("Error")); }
public JsonResult Insert([FromBody] Business item) { if (item != null) { try { Business BusinessInfo = new Business { MandatoryInformationId = item.MandatoryInformationId }; var insertedItem = _context.Add <Business>(BusinessInfo); _context.SaveChanges(); return(Json(insertedItem.Entity)); } catch (Exception e) { return(Json(e.Message)); } } return(Json("Error")); }
public JsonResult Insert([FromBody] Municipality item) { if (item != null) { try { Municipality municipalityInfo = new Municipality { MandatoryInformationId = item.MandatoryInformationId, NumberOfSchool = item.NumberOfSchool }; var insertedItem = _context.Add <Municipality>(municipalityInfo); _context.SaveChanges(); return(Json(insertedItem.Entity)); } catch (Exception e) { return(Json(e.Message)); } } return(Json("Error")); }
public JsonResult Insert([FromBody] Depatment item) { if (item != null) { try { Depatment MandatoryInfo = new Depatment { Name = item.Name, UserId = item.UserId, Address = item.Address, }; var insertedItem = _context.Add <Depatment>(MandatoryInfo); _context.SaveChanges(); return(Json(insertedItem.Entity)); } catch (Exception e) { return(Json(e.Message)); } } return(Json("Error")); }