public async Task <DbStatusCode> SaveCompany(CompanyVM model) { try { genericRepository.Add(new CompanyModel() { Id = Guid.NewGuid(), CompanyName = model.CompanyName, CompanyDescription = model.CompanyDescription, UserId = model.UserId }); var changedVal = await unitOfWork.Commit(); if (changedVal > 0) { return(DbStatusCode.Created); } else { return(DbStatusCode.DbError); } } catch (Exception ex) { //logging an exception return(DbStatusCode.Exception); } }
public async Task <DbStatusCode> SaveConsultant(ConsultantVM model) { try { genericRepository.Add(new ConsultantModel() { Id = Guid.NewGuid(), FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, IsActive = model.IsActive, IsAdmin = model.IsAdmin, CompanyId = model.CompanyId, UserId = model.UserId }); var changedVal = await unitOfWork.Commit(); if (changedVal > 0) { return(DbStatusCode.Created); } else { return(DbStatusCode.DbError); } } catch (Exception ex) { //logging an exception return(DbStatusCode.Exception); } }