Skip to content

Instantly share code, notes, and snippets.

@Pownraj-2818
Created August 19, 2022 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pownraj-2818/e1a5924d49497b1200642c3b478b4918 to your computer and use it in GitHub Desktop.
Save Pownraj-2818/e1a5924d49497b1200642c3b478b4918 to your computer and use it in GitHub Desktop.
public async Task Create(SpaceCategoryRequestModel model)
{
if (_context.SpaceCategories.Any(x => x.SpaceCategoryName == model.SpaceCategoryName && !x.IsDeleted))
throw new Exception("Space category already exists!");
SpaceCategory newCategory = _mapper.Map<SpaceCategory>(model);
_context.SpaceCategories.Add(newCategory);
await _context.SaveChangesAsync();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment