コード例 #1
0
        public async Task <ActionResult> CreateAnnouncement(AnnouncementViewModel vm)
        {
            if (ModelState.IsValid)
            {
                AnnouncementCreateDTO entity = new AnnouncementCreateDTO
                {
                    CategoryId  = vm.CategoryId,
                    Title       = vm.Title,
                    Description = vm.Description,
                    Email       = vm.Email,
                    Phonenumber = vm.Phonenumber
                };
                string url = "http://api.summercamp.stage02.netromsoftware.ro/api/announcements/NewAnnouncement";
                using (HttpClient httpClient = new HttpClient())
                {
                    JavaScriptSerializer serialize = new JavaScriptSerializer();
                    serialize.Serialize(entity);
                    var json = new JavaScriptSerializer().Serialize(entity);

                    StringContent content = new StringContent(json, Encoding.UTF8, "application/json");

                    HttpClient client = new HttpClient();

                    HttpResponseMessage response = await client.PostAsync(url, content);

                    return(RedirectToAction("Index"));
                }
            }

            return(View("Error"));
        }
コード例 #2
0
        public async Task <IActionResult> SaveEntity(AppUserViewModel userVm)
        {
            if (!ModelState.IsValid)
            {
                IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(allErrors));
            }
            if (userVm.Id == null)
            {
                var announcement = new AnnouncementViewModel()
                {
                    Content     = $"User {userVm.UserName} has been created",
                    DateCreated = DateTime.Now,
                    Status      = Status.Active,
                    Title       = "User created",
                    UserId      = User.GetUserId(),
                    Id          = Guid.NewGuid().ToString()
                };
                await _userService.AddAsync(userVm);

                await _hubContext.Clients.All.SendAsync("ReceiveMessage", announcement);
            }
            else
            {
                await _userService.UpdateAsync(userVm);
            }
            return(new OkObjectResult(userVm));
        }
        public ActionResult Details(int?id)
        {
            Announcement          announcement = db.Announcements.Find(id);
            AnnouncementViewModel model        = Mapper.Map <Announcement, AnnouncementViewModel>(announcement);

            return(View(model));
        }
コード例 #4
0
        public async Task <IActionResult> SaveEntity(AppRoleViewModel roleVm)
        {
            if (!ModelState.IsValid)
            {
                IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(new BadRequestObjectResult(allErrors));
            }
            if (!roleVm.Id.HasValue)
            {
                var notificationId = Guid.NewGuid().ToString();
                var announcement   = new AnnouncementViewModel()
                {
                    Title       = "Role created",
                    DateCreated = DateTime.Now,
                    Content     = $"Role {roleVm.Name} has been created",
                    Id          = notificationId,
                    UserId      = User.GetUserId()
                };
                var announcementUsers = new List <AnnouncementUserViewModel>()
                {
                    new AnnouncementUserViewModel()
                    {
                        AnnouncementId = notificationId, HasRead = false, UserId = User.GetUserId()
                    }
                };
                await _roleService.AddAsync(announcement, announcementUsers, roleVm);

                //await _hubContext.Clients.All.SendAsync("ReceiveMessage", announcement);
            }
            else
            {
                await _roleService.UpdateAsync(roleVm);
            }
            return(new OkObjectResult(roleVm));
        }
        public async Task <IActionResult> Delete(string id)
        {
            if (!ModelState.IsValid)
            {
                return(new BadRequestResult());
            }
            else
            {
                var notificationId = Guid.NewGuid().ToString();
                var announcement   = new AnnouncementViewModel
                {
                    Title       = User.GetSpecificClaim("FullName"),
                    DateCreated = DateTime.Now,
                    Content     = $"Function {_functionService.GetById(id).Name} has been deleted",
                    Id          = notificationId,
                    UserId      = User.GetUserId(),
                    Image       = User.GetSpecificClaim("Avatar"),
                    Status      = Status.Active
                };
                var announcementUsers = new List <AnnouncementUserViewModel>()
                {
                    new AnnouncementUserViewModel()
                    {
                        AnnouncementId = notificationId, HasRead = false, UserId = User.GetUserId()
                    }
                };
                _functionService.Delete(announcement, announcementUsers, id);
                _functionService.Save();
                await _hubContext.Clients.All.SendAsync("ReceiveMessage", announcement);

                return(new OkObjectResult(id));
            }
        }
コード例 #6
0
        public ActionResult GetAllAnnouncements()
        {
            var viewModel = new AnnouncementViewModel();

            viewModel = _service.getAllAnnouncements();
            return(View(viewModel));
        }
コード例 #7
0
        public async Task <IActionResult> Index(ContactPageViewModel model)
        {
            if (ModelState.IsValid)
            {
                await _feedbackService.Add(model.Feedback);

                _feedbackService.SaveChanges();
                var announcement = new AnnouncementViewModel()
                {
                    Content     = $"Bạn có một phản hồi từ {model.Feedback.Name}",
                    DateCreated = DateTime.Now,
                    Status      = Status.Active,
                    Title       = "New Order",
                    UserId      = User.GetUserId(),
                    Id          = Guid.NewGuid().ToString()
                };
                //  await _hubContext.Clients.Client("").SendAsync("ReceiveMessage", announcement);
                await _hubContext.Clients.All.SendAsync("ReceiveMessage", announcement);

                var content = await _viewRenderService.RenderToStringAsync("Contact/_ContactMail", model.Feedback);

                await _emailSender.SendEmailAsync(_configuration["MailSettings:AdminMail"], "Have new contact feedback", content);

                ViewData["Success"] = true;
            }

            model.Contact = await _contactService.GetById("default");

            return(View("Index", model));
        }
コード例 #8
0
        public AnnouncementViewModel GetAnnouncement(string id)
        {
            AnnouncementViewModel item = new AnnouncementViewModel();

            if (id == null)
            {
                return(item);
            }

            var aid = new Guid(id);
            var row = dbContext.Announcements.FirstOrDefault(x => x.Id == aid);

            if (row != null)
            {
                item.Id           = row.Id;
                item.SellerId     = row.SellerId;
                item.DateBidding  = row.DateBidding.Value.ToString("dd/MM/yyyy");
                item.StartPrice   = row.StartPrice;
                item.Margin       = row.Margin;
                item.DeadlineDate = row.DeadlineDate.Value.ToString("dd/MM/yyyy");
                item.GoodsName    = row.GoodsName;
                item.Composition  = row.Composition;
                item.LotSize      = row.LotSize;
                item.LotCount     = row.LotCount;
                item.TypeDelivery = row.TypeDelivery;
                item.DateDelivery = row.DateDelivery.Value.ToString("dd/MM/yyyy");
                item.PaymentType  = row.PaymentType;
                item.Status       = row.Status;
                item.StatusName   = (row.Status == 1) ? "На подтверждении" : "Прием заявок";
                item.No           = row.No;
            }

            return(item);
        }
コード例 #9
0
 public async Task <IActionResult> SaveEntity(SlideViewModel slideViewModel)
 {
     if (!ModelState.IsValid)
     {
         var allErrors = ModelState.Values.SelectMany(v => v.Errors);
         return(new BadRequestObjectResult(allErrors));
     }
     else
     {
         if (slideViewModel.Id == 0)
         {
             var notificationId = Guid.NewGuid().ToString();
             var announcement   = new AnnouncementViewModel
             {
                 Title       = User.GetSpecificClaim("FullName"),
                 DateCreated = DateTime.Now,
                 Content     = $"Slide {slideViewModel.Name} has been created",
                 Id          = notificationId,
                 UserId      = User.GetUserId(),
                 Image       = User.GetSpecificClaim("Avatar"),
                 Status      = Status.Active
             };
             var announcementUsers = new List <AnnouncementUserViewModel>()
             {
                 new AnnouncementUserViewModel()
                 {
                     AnnouncementId = notificationId, HasRead = false, UserId = User.GetUserId()
                 }
             };
             _slideService.Add(announcement, announcementUsers, slideViewModel);
             await _hubContext.Clients.All.SendAsync("ReceiveMessage", announcement);
         }
         else
         {
             var notificationId = Guid.NewGuid().ToString();
             var announcement   = new AnnouncementViewModel
             {
                 Title       = User.GetSpecificClaim("FullName"),
                 DateCreated = DateTime.Now,
                 Content     = $"Slide {slideViewModel.Name} has been updated",
                 Id          = notificationId,
                 UserId      = User.GetUserId(),
                 Image       = User.GetSpecificClaim("Avatar"),
                 Status      = Status.Active
             };
             var announcementUsers = new List <AnnouncementUserViewModel>()
             {
                 new AnnouncementUserViewModel()
                 {
                     AnnouncementId = notificationId, HasRead = false, UserId = User.GetUserId()
                 }
             };
             _slideService.Update(announcement, announcementUsers, slideViewModel);
             await _hubContext.Clients.All.SendAsync("ReceiveMessage", announcement);
         }
         _slideService.Save();
         return(new OkObjectResult(slideViewModel));
     }
 }
コード例 #10
0
        public ActionResult Create()
        {
            AnnouncementViewModel item = new AnnouncementViewModel();

            item.StartDate = DateTime.Now;
            item.EndDate   = DateTime.Now;
            return(View(item));
        }
コード例 #11
0
        public ActionResult Create(AnnouncementViewModel model)
        {
            model.UserId = userRepository.GetUser(GetAutoUser().UserName).Id;
            var announ = model.ToEntity();

            announRepository.Create(announ);
            return(RedirectToAction("Index"));
        }
コード例 #12
0
        // GET: Announcements/Create
        public ActionResult Create()
        {
            var viewModel = new AnnouncementViewModel
            {
                ExpirationDate = DateTime.Now.Add(TimeSpan.FromDays(7))
            };

            return(View(viewModel));
        }
コード例 #13
0
        public IActionResult CreateAnnoucement(AnnouncementViewModel announcementViewModel)
        {
            if (announcementViewModel != null)
            {
                _announcementService.AddAnnoucement(announcementViewModel);
            }

            return(new  OkObjectResult(""));
        }
コード例 #14
0
        public async Task <IActionResult> CreateAnnoucement(AnnouncementViewModel announcementViewModel)
        {
            if (announcementViewModel != null)
            {
                await _announcementService.AddAnnoucement(announcementViewModel);
            }

            return(new  OkObjectResult(""));
        }
コード例 #15
0
        /// <summary>
        /// Push to a specific user
        /// </summary>
        /// <param name="who"></param>
        /// <param name="message"></param>
        public static void PushToUser(string who, AnnouncementViewModel message, TeduShopHub hub)
        {
            IHubConnectionContext <dynamic> clients = GetClients(hub);

            foreach (var connectionId in _connections.GetConnections(who))
            {
                clients.Client(connectionId).addChatMessage(message);
            }
        }
コード例 #16
0
        private IPagedList <BrochureAndAnnouncement> searchAnnouncement(AnnouncementViewModel model)
        {
            IPagedList <BrochureAndAnnouncement> list = db.brochureAndAnnouncement
                                                        .Where(x => x.type == BrochureAndAnnouncement.TYPE_ANNOUNCEMENT)
                                                        .OrderByDescending(x => x.createDate)
                                                        .ToPagedList(model.pageNumber - 1, model.pageSize);

            return(list);
        }
コード例 #17
0
        public ActionResult Edit(int id, FormCollection collection, string Upload)
        {
            var announcement = _entities.Announcements.Single(a => a.ID == id);

            try
            {
                ImageController   ac          = new ImageController();
                List <UploadFile> uploadFiles = ac.GenerateAttachFileCollectionID(collection, "Announcement");

                if (Upload != null)
                {
                    ImageUploadToServer();

                    if (uploadFiles != null)
                    {
                        ModelStateSetting(uploadFiles, "Announcement");
                    }

                    UpdateModel(announcement, "Announcement");
                    var viewModel = new AnnouncementViewModel()
                    {
                        Announcement = announcement,
                    };
                    return(View(viewModel));
                }

                List <AnnouncementUploadFile> aUploadFiles = announcement.AnnouncementUploadFiles.ToList();
                foreach (AnnouncementUploadFile aUploadFile in aUploadFiles)
                {
                    announcement.AnnouncementUploadFiles.Remove(aUploadFile);
                }

                foreach (UploadFile uploadFile in uploadFiles)
                {
                    AnnouncementUploadFile auf = new AnnouncementUploadFile();
                    auf.UploadFileID = uploadFile.ID;
                    announcement.AnnouncementUploadFiles.Add(auf);
                }

                announcement.AnnounceDate = DateTime.Parse(collection.GetValues("Announcement.AnnounceDate")[0]);
                announcement.Description  = collection.GetValues("Announcement.Description")[0];
                announcement.IsPublic     = bool.Parse(collection.GetValues("Announcement.IsPublic")[0]);
                announcement.Name         = collection.GetValues("Announcement.Name")[0];
                announcement.StaticURL    = collection.GetValues("Announcement.StaticURL")[0];
                //announcement. = collection.Get("Announcement.URLChecked");

                //UpdateModel(announcement, "Announcement");
                _entities.SaveChanges();

                return(RedirectToAction("Index", new { announceGroupID = announcement.AnnounceGroupID }));
            }
            catch
            {
                return(View());
            }
        }
コード例 #18
0
        public ActionResult Announcement(Guid announcementId)
        {
            var model        = new AnnouncementViewModel();
            var announcement = DataAccess.GetAnnouncement(announcementId);

            model.Title       = announcement.Title;
            model.Body        = announcement.Body;
            model.PublishDate = announcement.PublishDate;
            return(View(model));
        }
コード例 #19
0
        public ActionResult Detial(int id)
        {
            var announcements = _announcementService.GetById(id);
            var model         = new AnnouncementViewModel
            {
                Announcement = announcements
            };

            return(View(model));
        }
コード例 #20
0
 public static Announcement ToEntity(this AnnouncementViewModel model) =>
 new Announcement
 {
     Id          = model.Id,
     Name        = model.Name,
     CategoryId  = model.CategoryId,
     Description = model.Description,
     Price       = model.Price,
     UserId      = model.UserId
 };
コード例 #21
0
        public async Task <IActionResult> Edit(int id, [FromForm] AnnouncementViewModel announcementModel)
        {
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap <AnnouncementViewModel, AnnouncementDto>()).CreateMapper();

            var announcementDto = mapper.Map <AnnouncementDto>(announcementModel);

            await _announcementService.UpdateAnnouncementAsync(id, announcementDto);

            return(Ok());
        }
コード例 #22
0
        public ActionResult Create(AnnouncementViewModel viewmodel)
        {
            HttpPostedFileBase file = viewmodel.ImageStore;
            dynamic            showMessageString = string.Empty;

            if (ModelState.IsValid && file != null)
            {
                if (file != null && file.FileName != null && file.FileName != "")
                {
                    var      fileExtension = new string[] { "jpeg", "jpg", "png", "gif", "bmp", ".jpeg", ".jpg", ".png", ".gif", ".bmp" };
                    FileInfo fi            = new FileInfo(file.FileName);
                    if (fileExtension.Contains(fi.Extension.ToLower()))
                    {
                        var announcementEntity = new Annoucement();
                        announcementEntity.Title           = viewmodel.Title;
                        announcementEntity.Details         = viewmodel.Details;
                        announcementEntity.StartDate       = viewmodel.StartDate;
                        announcementEntity.EndDate         = viewmodel.EndDate;
                        announcementEntity.IsPopup         = viewmodel.IsPopup;
                        announcementEntity.Priority        = viewmodel.Priority;
                        announcementEntity.Image           = FileHelper.ConvertToBytes(file);
                        announcementEntity.CreatedDateTime = DateTime.Now;
                        announcementEntity.Id = Guid.NewGuid();

                        try
                        {
                            db.Annoucements.Add(announcementEntity);
                            db.SaveChanges();
                            showMessageString = new
                            {
                                param1 = 200,
                                param2 = "Insert data successfully !!!"
                            };
                        }
                        catch (Exception)
                        {
                            showMessageString = new
                            {
                                param1 = 404,
                                param2 = "Exception occured while insert database"
                            };
                        }
                    }
                }
            }
            else
            {
                showMessageString = new
                {
                    param1 = 404,
                    param2 = "Input data is not valid!"
                };
            }
            return(Json(showMessageString, JsonRequestBehavior.AllowGet));
        }
コード例 #23
0
        public GenericResult Update(AnnouncementViewModel announcementViewModel, List <AnnouncementUserViewModel> announcementUsers, ProductReceiptViewModel productReceiptViewModel)
        {
            try
            {
                // Mapping to order domain
                var receipt = _mapper.Map <ProductReceiptViewModel, ProductReceipt>(productReceiptViewModel);
                // Lấy Toàn Bộ Chi Tiết Hóa Đơn Ra Sau Khi Mapping Vào
                var recriptDetails = receipt.ProductReceiptDetails;
                // Them 1 chi tiet hoa don
                var addDetails = recriptDetails.Where(x => x.Id == 0).ToList();
                // Update Chi Tiet hoa don
                var updateDetails = recriptDetails.Where(x => x.Id != 0).ToList();
                // Existed Details
                var existedDetails = _productReceiptDetailRepository.FindAll(x => x.ProductReceiptId == productReceiptViewModel.Id).ToList();
                //Clear db
                receipt.ProductReceiptDetails.Clear();
                _productReceiptDetailRepository.RemoveMultiple(existedDetails.Except(updateDetails).ToList());
                foreach (var receiptDetail in updateDetails)
                {
                    var product = _productRepository.FindById(receiptDetail.ProductId);
                    if (product.Price == 0 || product.Price < receiptDetail.OriginalPrice)
                    {
                        product.Price = receiptDetail.OriginalPrice + (receiptDetail.OriginalPrice * 10 / 100);
                        _productRepository.Update(product);
                    }
                    _productReceiptDetailRepository.Update(receiptDetail);
                }

                foreach (var receiptDetail in addDetails)
                {
                    var product = _productRepository.FindById(receiptDetail.ProductId);
                    if (product.Price == 0 || product.Price < receiptDetail.OriginalPrice)
                    {
                        product.Price = receiptDetail.OriginalPrice + (receiptDetail.OriginalPrice * 10 / 100);
                        _productRepository.Update(product);
                    }
                    _productReceiptDetailRepository.Add(receiptDetail);
                }

                receipt.Total = updateDetails.Sum(x => x.Quantity * x.OriginalPrice) + addDetails.Sum(x => x.Quantity * x.OriginalPrice);
                _productReceiptRepository.Update(receipt);
                // Real Time
                var announcement = _mapper.Map <AnnouncementViewModel, Announcement>(announcementViewModel);
                _announceRepository.Add(announcement);
                foreach (var announcementUserViewModel in announcementUsers)
                {
                    _announceUserRepository.Add(_mapper.Map <AnnouncementUserViewModel, AnnouncementUser>(announcementUserViewModel));
                }
                return(new GenericResult(true, "Update Successful", "Successful"));
            }
            catch (Exception)
            {
                return(new GenericResult(false, "Update Failed", "Error"));
            }
        }
コード例 #24
0
        // GET: Announcements/Delete/5
        public ActionResult Delete(string partitionKey, string rowKey)
        {
            var viewModel = AnnouncementHelper.GetAnnouncementViewModel(partitionKey, rowKey);

            if (viewModel == null)
            {
                viewModel = new AnnouncementViewModel();
            }

            return(View(viewModel));
        }
 public ActionResult Edit(AnnouncementViewModel model)
 {
     if (ModelState.IsValid)
     {
         Announcement announcement = Mapper.Map <AnnouncementViewModel, Announcement>(model);
         db.Entry(announcement).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
コード例 #26
0
        public ActionResult Create(AnnouncementViewModel announcement)
        {
            SqlConnection con = new SqlConnection(connection);

            con.Open();
            string     query = "INSERT INTO Announcement(Text,PersonId,CourseId)VALUES ('" + announcement.text + "','" + 3 + "','" + cid + "')";
            SqlCommand cmd   = new SqlCommand(query, con);

            cmd.ExecuteNonQuery();

            return(View("Index"));
        }
コード例 #27
0
        public void Create(BillViewModel billVm, AnnouncementViewModel announcementVm)
        {
            var order       = Mapper.Map <BillViewModel, Bill>(billVm);
            var orderDetail = Mapper.Map <List <BillDetailViewModel>, List <BillDetail> >(billVm.BillDetails);

            order.BillDetails = orderDetail;

            var announcement = Mapper.Map <AnnouncementViewModel, Announcement>(announcementVm);

            _billRepository.Add(order);
            _announcementRepository.Add(announcement);
        }
コード例 #28
0
        public HttpResponseMessage Create(HttpRequestMessage request, AnnouncementViewModel announcementVm)
        {
            if (ModelState.IsValid)
            {
                var newAnnoun = new Announcement();
                try
                {
                    newAnnoun.Content     = announcementVm.Content;
                    newAnnoun.Status      = announcementVm.Status;
                    newAnnoun.Title       = announcementVm.Title;
                    newAnnoun.CreatedDate = DateTime.Now;
                    newAnnoun.UserId      = User.Identity.GetUserId();
                    var listUser = AppUserManager.Users;
                    //foreach (var user in announcementVm.AnnouncementUsers)
                    //{
                    //    newAnnoun.AnnouncementUsers.Add(new AnnouncementUser()
                    //    {
                    //        UserId = user.UserId,
                    //        HasRead = false
                    //    });
                    //}
                    foreach (var user in listUser)
                    {
                        newAnnoun.AnnouncementUsers.Add(new AnnouncementUser()
                        {
                            UserId  = user.Id,
                            HasRead = false
                        });
                    }
                    _announcementService.Create(newAnnoun);
                    _announcementService.Save();
                    var listuser = _announcementService.ListByNotificationId(newAnnoun.ID);
                    var announ   = _announcementService.GetDetail(newAnnoun.ID);
                    var appuser  = AppUserManager.FindById(newAnnoun.UserId);
                    announ.AppUser = appuser;
                    var announVm = Mapper.Map <Announcement, AnnouncementViewModel>(announ);
                    announVm.AnnouncementUsers = null;
                    //push notification, push user vào signaIR
                    TMDTHub.PushToAllUsers(announVm, null);

                    return(request.CreateResponse(HttpStatusCode.OK, announcementVm));
                }
                catch (Exception dex)
                {
                    return(request.CreateErrorResponse(HttpStatusCode.BadRequest, dex.Message));
                }
            }
            else
            {
                return(request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
コード例 #29
0
        // GET: Announcements/Edit/5
        public ActionResult Edit(string partitionKey, string rowKey)
        {
            var viewModel = AnnouncementHelper.GetAnnouncementViewModel(partitionKey, rowKey);

            if (viewModel == null)
            {
                viewModel = new AnnouncementViewModel();
            }

            viewModel.AnnouncementHtml = WebUtility.HtmlDecode(viewModel.AnnouncementHtml);

            return(View("Create", viewModel));
        }
コード例 #30
0
        /// <summary>
        /// Push to list users
        /// </summary>
        /// <param name="who"></param>
        /// <param name="message"></param>
        public static void PushToUsers(string[] whos, AnnouncementViewModel message, TeduShopHub hub)
        {
            IHubConnectionContext <dynamic> clients = GetClients(hub);

            for (int i = 0; i < whos.Length; i++)
            {
                var who = whos[i];
                foreach (var connectionId in _connections.GetConnections(who))
                {
                    clients.Client(connectionId).addChatMessage(message);
                }
            }
        }
コード例 #31
0
 public ActionResult Edit(AnnouncementViewModel model, int[] uploadedfile)
 {
     if (ModelState.IsValid)
     {
         Announcement ann = announcementService.GetAnnouncement(model.ID);
         ann = AutoMapper.Mapper.Map<AnnouncementViewModel, Announcement>(model, ann);
         if (uploadedfile != null && uploadedfile.Length > 0)
         {
             foreach( int id in uploadedfile)
             {
                 File file = fileService.getFile(id);
                 if (file != null)
                 {
                     ann.AttachmentFiles.Add(file);
                 }
             }
         }
         ann.LastUpdatedDate = DateTime.UtcNow;
         ApplicationUser user = memberService.GetUser(User.Identity.Name);
         ann.AuthorUserID = user.Id;
         ann.LastUpdatedUserID = user.Id;
         announcementService.SaveAnnouncement();
         TempData["ReloadData"] = true;
         return RedirectToAction("View", new { id = ann.ID});
     }
     if (uploadedfile != null)
     {
         if(model.AttachmentFiles == null)
             model.AttachmentFiles = new List<File>();
         foreach (var id in uploadedfile)
         {
             File file = fileService.getFile(id);
             if (file != null)
                 model.AttachmentFiles.Add(file);
         }
     }
     return View(model);
 }