public async System.Threading.Tasks.Task <IHttpActionResult> PostAsync(StoreAdministrator storeAdmin) { var mngEmail = new EmailManager(); var email = new Email { Mail = storeAdmin.Email, Name_1 = storeAdmin.Name_1, Last_Name_1 = storeAdmin.Last_Name1 }; await mngEmail.Send(email); try { var mng = new StoreAdministratorManager(); mng.Create(storeAdmin); apiResp = new ApiResponse(); apiResp.Message = "Action was executed."; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
internal SqlOperation GetRetriveStatementByEmail(StoreAdministrator storeAdmin) { var operation = new SqlOperation { ProcedureName = "RET_SELLER_STORE_EMAIL_PR" }; operation.AddVarcharParam(DB_COL_EMAIL, storeAdmin.Email); return(operation); }
public T RetrieveStoreByEmail <T>(StoreAdministrator storeAdmin) { var lstResult = dao.ExecuteQueryProcedure(mapper.GetRetriveStatementByEmail(storeAdmin)); var dic = new Dictionary <string, object>(); if (lstResult.Count > 0) { dic = lstResult[0]; var objs = mapper.BuildObject(dic); return((T)Convert.ChangeType(objs, typeof(T))); } return(default(T)); }
public BaseEntity BuildObject(Dictionary <string, object> row) { var storeAdmin = new StoreAdministrator { Name = GetStringValue(row, DB_COL_NAME), FirstLastName = GetStringValue(row, DB_COL_LAST_NAME1), SecondLastName = GetStringValue(row, DB_COL_LAST_NAME2), Email = GetStringValue(row, DB_COL_EMAIL), Password = GetStringValue(row, DB_COL_PASSWORD), Active = GetBooleanValue(row, DB_COL_ACTIVE) }; return(storeAdmin); }
public BaseEntity BuildObject(Dictionary <string, object> row) { var storeAdmin = new StoreAdministrator { Id = GetStringValue(row, DB_COL_ID), Name_1 = GetStringValue(row, DB_COL_NAME), Last_Name1 = GetStringValue(row, DB_COL_LAST_NAME1), Last_Name2 = GetStringValue(row, DB_COL_LAST_NAME2), Email = GetStringValue(row, DB_COL_EMAIL), Id_Store = GetStringValue(row, DB_COL_STORE), Active = GetBooleanValue(row, DB_COL_ACTIVE), Phone_1 = GetStringValue(row, DB_COL_PHONE) }; return(storeAdmin); }
public IHttpActionResult Put(StoreAdministrator storeAdministrator) { try { var mng = new StoreAdministratorManager(); mng.Update(storeAdministrator); apiResp = new ApiResponse(); apiResp.Message = "Action was executed."; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
public IHttpActionResult Delete(StoreAdministrator storeAdministrator) { try { var mng = new StoreAdministratorManager(); mng.Delete(storeAdministrator); apiResp = new ApiResponse(); apiResp.Message = "Se ha " + storeAdministrator.State + " '" + storeAdministrator.Email + "' correctamente."; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
public StoreAdministrator RetrieveByEmail(StoreAdministrator storeAdministrator) { StoreAdministrator sa = null; try { sa = storeAdmin.Retrieve <StoreAdministrator>(storeAdministrator); if (sa == null) { throw new BussinessException(4); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } return(sa); }
public void Create(StoreAdministrator storeAdmin) { try { var d = this.storeAdmin.Retrieve <StoreAdministrator>(storeAdmin); if (d != null) { throw new BussinessException(3); } else { this.storeAdmin.Create(storeAdmin); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }
public IHttpActionResult Get(string email) { try { var mng = new StoreAdministratorManager(); var storeAdmin = new StoreAdministrator { Email = email }; storeAdmin = mng.RetrieveByEmail(storeAdmin); apiResp = new ApiResponse(); apiResp.Data = storeAdmin; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
public List <Store> RetrieveStoreByUserEmail(StoreAdministrator StoreAdministrator) { var clients = storeCrud.RetrieveStoreByUserEmail <Store>(StoreAdministrator); return(clients); }
public void Delete(StoreAdministrator StoreAdmin) { storeAdmin.Delete(StoreAdmin); }
public void Update(StoreAdministrator storeAdministrator) { storeAdmin.Update(storeAdministrator); }