Beispiel #1
0
        public async Task <ActionResult <long> > Update(SaveDataSheet saveDataSheet)
        {
            var data = await service.Update(saveDataSheet, UserData.CorpClientId.Value);

            if (data != null)
            {
                return(Ok(data));
            }
            return(NoContent());
        }
Beispiel #2
0
        public async Task <DataSheet> Save(SaveDataSheet dataSheet, int corpClientId)
        {
            var data = await context.DataSheets
                       .Include(d => d.DataSheetItems)
                       .Where(d => d.ProductId == dataSheet.ProductId && d.Product.CorpClientId == corpClientId).FirstOrDefaultAsync();

            if (data == null)
            {
                data = mapper.Map <ef.DataSheet>(dataSheet);
                context.DataSheets.Add(data);
                await context.SaveChangesAsync();
            }
            else
            {
                data.ProcedureDescription      = dataSheet.ProcedureDescription;
                data.WeightVariationPercentage = dataSheet.WeightVariationPercentage;
                data.IncreaseWeight            = dataSheet.IncreaseWeight;
                context.DataSheets.Update(data);
                await context.SaveChangesAsync();
            }

            return(mapper.Map <DataSheet>(data));
        }
Beispiel #3
0
        public async Task <long> Update(SaveDataSheet saveDataSheet, int corpClientId)
        {
            var result = await dataSheetApp.Save(saveDataSheet, corpClientId);

            return(result.DataSheetId);
        }
Beispiel #4
0
 public async Task <DataSheet> Save(SaveDataSheet dataSheet, int corpClientId)
 {
     return(await repository.Save(dataSheet, corpClientId));
 }