// PUT public IHttpActionResult Put(SellerStore selller) { try { var mng = new SellerStoreManager(); mng.Update(selller); apiResp = new ApiResponse(); // apiResp.Message = "Vendedor modificado exitosamente."; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
//public IHttpActionResult Put(SellerStore selller) //{ // try // { // var mng = new SellerStoreManager(); // mng.UpdatePassword(selller); // apiResp = new ApiResponse(); // apiResp.Message = "contraseña modificada."; // return Ok(apiResp); // } // catch (BussinessException bex) // { // return InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)); // } //} // DELETE public IHttpActionResult Delete(SellerStore seller) { try { var mng = new SellerStoreManager(); mng.Delete(seller); apiResp = new ApiResponse(); // apiResp.Message = "Estado modificado."; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
public SellerStore RetrieveById(SellerStore seller) { SellerStore s = null; try { s = crudSeller.Retrieve <SellerStore>(seller); if (s == null) { throw new BussinessException(4); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } return(s); }
//Get by state //public IHttpActionResult Get(bool Active) //{ // try // { // var mng = new SellerStoreManager(); // var seller = new SellerStore // { // ACTIVE = Active // }; // apiResp.Data = mng.RetrieveByState(seller); // return Ok(apiResp); // } // catch (BussinessException bex) // { // return InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)); // } //} // POST public async System.Threading.Tasks.Task <IHttpActionResult> PostAsync(SellerStore seller) { var mngEmail = new EmailManager(); var email = new Email { Mail = seller.Email, Name_1 = seller.Name_1, Last_Name_1 = seller.Last_Name_1, Code = "P@as123s" }; await mngEmail.Send(email); try { var mng = new SellerStoreManager(); if (seller.Phone_2 == "" || seller.Phone_2 == null) { seller.Phone_2 = ""; } if (seller.Last_Name_2 == "" || seller.Last_Name_2 == null) { seller.Last_Name_2 = ""; } if (seller.Name_2 == "" || seller.Name_2 == null) { seller.Name_2 = ""; } mng.Create(seller); apiResp = new ApiResponse { Message = "Vendedor registrado exitosamente." }; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
// GET by name public IHttpActionResult Get(string email) { try { var mng = new SellerStoreManager(); var seller = new SellerStore { Email = email }; seller = mng.RetrieveById(seller); apiResp = new ApiResponse(); apiResp.Data = seller; return(Ok(apiResp)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }
public BaseEntity BuildObject(Dictionary <string, object> row) { var seller = new SellerStore { Email = GetStringValue(row, DB_COL_EMAIL), ID = GetStringValue(row, DB_COL_ID), Url_Photo_ID = GetStringValue(row, DB_COL_URL_PHOTO_ID), ID_Rol = GetIntValue(row, DB_COL_ID_ROL), Name_1 = GetStringValue(row, DB_COL_NAME_1), Name_2 = GetStringValue(row, DB_COL_NAME_2), Last_Name_1 = GetStringValue(row, DB_COL_LAST_NAME_1), Last_Name_2 = GetStringValue(row, DB_COL_LAST_NAME_2), Password = GetStringValue(row, DB_COL_PASSWORD), Phone_1 = GetStringValue(row, DB_COL_PHONE_1), Phone_2 = GetStringValue(row, DB_COL_PHONE_2), ID_Address = GetIntValue(row, DB_COL_ID_ADDRESS), Url_Profile_Pric = GetStringValue(row, DB_COL_URL_PROFILE_PRIC), Active = GetBooleanValue(row, DB_COL_ACTIVE), ID_Store = GetStringValue(row, DB_COL_ID_STORE), }; return(seller); }
public void Create(SellerStore seller) { try { Address a = crudAddress.Retrieve <Address>(seller); seller.ID_Address = a.Id; var s = crudSeller.Retrieve <SellerStore>(seller); if (s != null) { //SellerStore already exist throw new BussinessException(3); } else { seller.ID_Address = a.Id; crudSeller.Create(seller); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }
public void Delete(SellerStore seller) { crudSeller.Delete(seller); }
public void Update(SellerStore seller) { crudSeller.Update(seller); }
public List <SellerStore> RetrieveByState(SellerStore seller) { return(crudSeller.RetrieveByState <SellerStore>(seller)); }