Ejemplo n.º 1
0
        public async Task <IActionResult> Post(List <IFormFile> files)
        {
            if (files.Count != 2)
            {
                return(BadRequest("Invalid number of files"));
            }

            string file1 = Path.GetTempFileName();
            string file2 = Path.GetTempFileName();

            using (FileStream fs1 = System.IO.File.Create(file1))
            {
                await files[0].CopyToAsync(fs1);
            }

            using (FileStream fs2 = System.IO.File.Create(file2))
            {
                await files[1].CopyToAsync(fs2);
            }

            DifferenceModel model   = new DifferenceModel(file1, file2);
            Stream          bmpData = model.Compare();

            return(File(bmpData, "application/octet-stream"));
        }
Ejemplo n.º 2
0
        public static PriceDecrement ToEntity(this DifferenceModel model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new PriceDecrement
            {
                Cash = model.Cash,
                Credit = model.Credit,
                LevelId = model.LevelId,
                Row = model.Row,
                TierId = model.TierId,
                TierLevel = model.TierLevel
            });
        }
Ejemplo n.º 3
0
        public IActionResult GetDifference(DifferenceModel model)
        {
            if (model.FirstId != null && model.SecondId != null)
            {
                var returnModel = new DifferenceModel
                {
                    Differences = actionService.GetDiff(model.FirstId, model.SecondId),
                    Produts     = new List <Product>
                    {
                        tableService.GetById(model.FirstId.Value),
                        tableService.GetById(model.SecondId.Value)
                    }
                };

                return(View(returnModel));
            }

            return(View(new DifferenceModel
            {
                FirstId = model.FirstId,
                SecondId = model.SecondId,
                Produts = new List <Product>()
            }));
        }