示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] Otdel otdel)
        {
            if (id != otdel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(otdel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OtdelExists(otdel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(otdel));
        }
示例#2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Otdel otdel = await db.Otdels.FindAsync(id);

            db.Otdels.Remove(otdel);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#3
0
        /// <summary>
        /// Подписка на изменение Отдел
        /// </summary>
        /// <param name="otdel">Отдел</param>
        public static void SubscribeOtdel(Otdel otdel)
        {
            IHubContext context = GlobalHost.ConnectionManager.GetHubContext <SignalRinventory>();

            Loggers.Log4NetLogger.Info(new Exception("Модель Отдела рассылка пошла: " + otdel.IdOtdel + " " + otdel.NameOtdel));
            SerializeJson json = new SerializeJson();

            context.Clients.All.SubscribeOtdel(json.JsonLibaryIgnoreDate(otdel));
        }
示例#4
0
        public void RemoveOtdel(int otdelId)
        {
            Otdel otdel = _otdelRepository.GetId(otdelId);

            if (otdel != null)
            {
                _otdelRepository.Delete(otdelId);
                _otdelRepository.Save();
            }
        }
示例#5
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description")] Otdel otdel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(otdel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(otdel));
        }
示例#6
0
        public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] Otdel otdel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(otdel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(otdel));
        }
示例#7
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Code,Description")] Otdel otdel)
        {
            if (ModelState.IsValid)
            {
                db.Otdels.Add(otdel);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(otdel));
        }
示例#8
0
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Otdel otdel = await db.Otdels.FindAsync(id);

            if (otdel == null)
            {
                return(HttpNotFound());
            }
            return(View(otdel));
        }
示例#9
0
        public void CreateWord(WordprocessingDocument package, Otdel templateotdel, SenderUsers senders, object obj)
        {
            MainDocumentPart mainDocumentPart = package.AddMainDocumentPart();

            DocumentFormat.OpenXml.Wordprocessing.Document document = new DocumentFormat.OpenXml.Wordprocessing.Document();
            PageSetting   settingpage    = new PageSetting();
            DocumentsFull documentInvoce = new DocumentsFull();

            document.Append(settingpage.ParametrPageHorizontEditMargin(new PageMargin()
            {
                Top = 300, Right = 794, Bottom = 100, Left = 794, Header = 300, Footer = 700U, Gutter = 0U
            }));
            document.Append(documentInvoce.GenerateRuleUserTemplate(templateotdel, senders));
            mainDocumentPart.Document = document;
        }
示例#10
0
 public void UpdateOtdel(Otdel otdel)
 {
     _otdelRepository.Update(otdel);
     _otdelRepository.Save();
 }
示例#11
0
 public void CreateOtdel(Otdel otdel)
 {
     _otdelRepository.Create(otdel);
     _otdelRepository.Save();
 }
示例#12
0
 public void Put([FromBody] Otdel otdel)
 {
     _otdelService.UpdateOtdel(otdel);
 }
示例#13
0
 public void Post([FromBody] Otdel otdel)
 {
     _otdelService.CreateOtdel(otdel);
 }