public async Task <String> addNewPhotoshoot([FromBody] Photoshoots photoshootDto) { string user_id = await _ILoginHelper.GetLoginUserId(); photoshootDto.active_status = 1; photoshootDto.created_by = int.Parse(user_id); photoshootDto.created_at = _common.GetTimeStemp(); photoshootDto.updated_at = 0; photoshootDto.updated_by = 0; string productId = photoshootDto.products.ToString(); String newPhotoshootID = await _BadgerApiHelper.PostAsync <String>(photoshootDto, "/photoshoots/create"); var assignPhotoshoot = new ProductPhotoshoots(); //assignPhotoshoot.Add("product_id", productId); assignPhotoshoot.photoshoot_id = int.Parse(newPhotoshootID); assignPhotoshoot.product_shoot_status_id = 1; assignPhotoshoot.updated_by = int.Parse(user_id); assignPhotoshoot.updated_at = _common.GetTimeStemp(); assignPhotoshoot.products = photoshootDto.products; assignPhotoshoot.items = photoshootDto.items; String AssignPhotoshootStatus = await _BadgerApiHelper.PostAsync <String>(assignPhotoshoot, "/photoshoots/StartProductPhotoshoot"); return(AssignPhotoshootStatus); }
/* * Developer: Mohi * Date: 7-3-19 * Action: Create new photoshoot and return ID of that photoshoot * Input: FromBody * output: photoshoot id */ public string Create(Photoshoots NewPhotoshoot) { using (IDbConnection conn = Connection) { var result = conn.Insert <Photoshoots>(NewPhotoshoot); return(result.ToString()); } }
/* * Update Developer: Mohi * Date: 7-3-19 * Action: update photoshoots all values using common functon UpdateAsync * Input: Photoshoots Model * output: boolean return */ public async Task <Boolean> Update(Photoshoots PhotoshootsToUpdate) { using (IDbConnection conn = Connection) { var result = await conn.UpdateAsync <Photoshoots>(PhotoshootsToUpdate); return(result); } }
public async Task <List <Photoshoots> > GetAsync(int id) { List <Photoshoots> ToReturn = new List <Photoshoots>(); try { Photoshoots Res = await _PhotoshootRepo.GetById(id); ToReturn.Add(Res); } catch (Exception ex) { var logger = _loggerFactory.CreateLogger("internal_error_log"); logger.LogInformation("Problem happened in selecting the data for GetAsync with message" + ex.Message); } return(ToReturn); }
public async Task <ResponseModel> PostAsync([FromBody] Photoshoots photoshoot) { string NewInsertionID = "0"; try { NewInsertionID = _PhotoshootRepo.Create(photoshoot); int userId = photoshoot.created_by; foreach (var product_id in photoshoot.products.Select(x => x.product_id)) { int prodId = product_id; await _eventRepo.AddEventAsync(new EventModel(product_event_table_name) { EventName = photoshoot_created, EntityId = prodId, RefrenceId = Int32.Parse(NewInsertionID), UserId = userId }); await _eventRepo.AddEventAsync(new EventModel(user_event_table_name) { EventName = photoshoot_created, EntityId = userId, RefrenceId = prodId, UserId = userId, EventNoteId = prodId }); } } catch (Exception ex) { var logger = _loggerFactory.CreateLogger("internal_error_log"); logger.LogInformation("Problem happened in making new Photoshoots with message" + ex.Message); } return(ResponseHelper.GetResponse(NewInsertionID)); }