public async Task <ResponseModel> StartProductPhotoshoot([FromBody] ProductPhotoshoots photoshootToUpdate) { string UpdateResult = "Success"; try { Dictionary <String, String> ValuesToUpdate = new Dictionary <string, string>(); ValuesToUpdate.Add("photoshoot_id", photoshootToUpdate.photoshoot_id.ToString()); ValuesToUpdate.Add("product_shoot_status_id", photoshootToUpdate.product_shoot_status_id.ToString()); ValuesToUpdate.Add("updated_by", photoshootToUpdate.updated_by.ToString()); ValuesToUpdate.Add("updated_at", photoshootToUpdate.updated_at.ToString()); var productIds = photoshootToUpdate.products.Select(x => x.product_id); await _PhotoshootRepo.UpdateSpecific(ValuesToUpdate, "product_id IN (" + string.Join(',', productIds) + ")"); int userId = photoshootToUpdate.updated_by; int photoshootId = photoshootToUpdate.photoshoot_id; string productId = string.Empty; int photoShootStatus = 1; // var smallestSkuList = await _PhotoshootRepo.GetSmallestSkuByProduct(productIds.ToList()); var result = await _ItemServiceHelper.PostAsync <string>(photoshootToUpdate.items, "/item/UpdateProductItemForPhotoshoot/" + photoShootStatus); var eventModels = GenerateEventModels(productIds, userId, photoshootId); await _eventRepo.AddEventAsync(eventModels); } catch (Exception ex) { var logger = _loggerFactory.CreateLogger("internal_error_log"); logger.LogInformation("Problem happened in updating item barcode with message" + ex.Message); UpdateResult = "Failed"; } return(ResponseHelper.GetResponse(UpdateResult)); }
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); }
public async Task <string> addProductInPhotoshoot(int photoshoot_id, [FromBody] PhotoshootWithItems photoshoot) { string user_id = await _ILoginHelper.GetLoginUserId(); var assignPhotoshoot = new ProductPhotoshoots(); assignPhotoshoot.photoshoot_id = photoshoot_id; assignPhotoshoot.product_shoot_status_id = 1; assignPhotoshoot.updated_by = int.Parse(user_id); assignPhotoshoot.updated_at = _common.GetTimeStemp(); assignPhotoshoot.products = photoshoot.products; assignPhotoshoot.items = photoshoot.items; // await _BadgerApiHelper.PostAsync<string>(photoshoot.items, "/photoshoots/bulkupdatebarcode"); var AssignPhotoshootStatus = await _BadgerApiHelper.PostAsync <string>(assignPhotoshoot, "/photoshoots/StartProductPhotoshoot"); return(AssignPhotoshootStatus); }
/* * Developer: Mohi * Date: 7-3-19 * Action: Create photoshoot product in product_photoshoot * Input: FromBody * output: */ public async Task <string> CreatePhotoshootProduct(ProductPhotoshoots NewPhotoshoot) { string photoshootExistsQuery = "SELECT * FROM product_photoshoots WHERE product_id='" + NewPhotoshoot.product_id + "';"; using (IDbConnection conn = Connection) { var PhotoshootExists = await conn.QueryAsync <ProductPhotoshoots>(photoshootExistsQuery); if (PhotoshootExists == null || PhotoshootExists.Count() == 0) { var result = conn.Insert <ProductPhotoshoots>(NewPhotoshoot); return(result.ToString()); } else { return(PhotoshootExists.First().photoshoot_id.ToString()); } } }
public async Task <string> addNewPhotoshootProduct([FromBody] string value) { string Result = "success"; try { ProductPhotoshoots newPhotoshoots = JsonConvert.DeserializeObject <ProductPhotoshoots>(value); await _PhotoshootRepo.CreatePhotoshootProduct(newPhotoshoots); int userId = newPhotoshoots.created_by; int productId = newPhotoshoots.product_id; await _eventRepo.AddEventAsync(new EventModel(product_event_table_name) { EventName = product_photoshoot_created, EntityId = productId, RefrenceId = 0, UserId = userId }); await _eventRepo.AddEventAsync(new EventModel(user_event_table_name) { EventName = product_photoshoot_created, EntityId = userId, RefrenceId = productId, UserId = userId, EventNoteId = productId }); } catch (Exception ex) { var logger = _loggerFactory.CreateLogger("internal_error_log"); logger.LogInformation("Problem happened in add new Photoshoots product with message" + ex.Message); Result = "failed"; } return(Result); }