public bool RegisterAdmin(AdminUserRegistration o) { try { AdminUserRegistration adminObject = new AdminUserRegistration() { fullName = o.fullName, email = o.email, password = o.password, phone = o.phone, createdAt = o.createdAt, // Role = o.Role, updatedAt = o.updatedAt }; this.context.adminUserRegistrations.Add(adminObject); int result = this.context.SaveChanges(); if (result > 0) { return(true); } else { return(false); } } catch (Exception e) { throw e; } }
public bool RegisterAdmin(AdminUserRegistration o) { try { AdminUserRegistration adminObject = new AdminUserRegistration() { FullName = o.FullName, Email = o.Email, Password = o.Password, Phone = o.Phone, CreatedAt = o.CreatedAt, UpdatedAt = o.UpdatedAt }; this.context.adminUserRegistrations.Add(adminObject); int result = this.context.SaveChanges(); if (result > 0) { return(true); } else { return(false); } } catch (Exception e) { throw e; } }
public IActionResult RegisterAdmin(AdminUserRegistration admin) { try { if (this.adminBL.RegisterAdmin(admin)) { return(this.Ok(new { success = true, Message = "Admin record added successfully" })); } else { return(StatusCode(StatusCodes.Status500InternalServerError, new { success = false, Message = "Admin record is not added " })); } } catch (Exception e) { var sqlException = e.InnerException as SqlException; if (sqlException.Number == 2601 || sqlException.Number == 2627) { return(StatusCode(StatusCodes.Status409Conflict, new { success = false, ErrorMessage = "Cannot insert duplicate Email values." })); } else { return(this.BadRequest(new { success = false, Message = e.Message })); } } }
public bool RegisterAdmin(AdminUserRegistration admin) { try { return(this.adminRL.RegisterAdmin(admin)); } catch (Exception e) { throw e; } }