public Realtor Update(Realtor realtorChanges) { var realtor = _context.Realtors.Attach(realtorChanges); realtor.State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(realtorChanges); }
public async Task <string> CreateRealtor(CreateRealtorViewModel model) { string uniqueFileName = UploadedFile(model.Image); Realtor realtor = new Realtor { Name = model.Name, Description = model.Description, Phone = model.Phone, Email = model.Email, Image = uniqueFileName }; await _context.Realtors.AddAsync(realtor); await _context.SaveChangesAsync(); return("Successfully Created"); }