public IActionResult Create([FromBody] InstructorViewModel item) { if (item == null) { return(BadRequest()); } var instructor = new Instructor { Id = item.Id, FirstName = item.FirstName, LastName = item.LastName, State = item.State, Suburb = item.Suburb, Address = item.Address, School = item.School, Email = item.Email, Phone = item.Phone, Mobile = item.Mobile, Info = item.Info, //ProfilePic = item. Price = item.Price, Language = item.Language }; _context.Instructors.Add(instructor); _context.SaveChanges(); return(CreatedAtRoute("GetInstructor", new { id = instructor.Id }, instructor)); }
public IActionResult Create([FromBody] State item) { if (item == null) { return(BadRequest()); } _context.States.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetState", new { id = item.Id }, item)); }