Ejemplo n.º 1
0
        public ActionResult Execute(UI.Action action)
        {
            if (!action.Props.ContainsKey("FileId"))
            {
                throw new CustomValidationException("There is not Prop FileId");
            }

            var fileId = Convert.ToInt32(action.Props["FileId"]);

            var fileService = new DAL.Services.DbFileService();

            var file = fileService.GetFile(fileId);

            return(new ActionResult()
            {
                Success = true,
                ActionType = action.ActionType,
                Data = new Incoming.File()
                {
                    Name = file.Name,
                    ContentType = file.ContentType,
                    ContentData = file.ContentData
                }
            });
        }
Ejemplo n.º 2
0
        public ActionResult Execute(UI.Action action)
        {
            if (!action.Props.ContainsKey("FileId"))
            {
                throw new CustomValidationException("There is not Prop FileId");
            }

            int fileId = Convert.ToInt32(action.Props["FileId"]);

            DAL.Services.DbFileService fileService = new DAL.Services.DbFileService();

            DAL.Models.File file = fileService.GetFile(fileId);

            file.Deleted    = true;
            file.DeleteDate = DateTime.Now;
            file.DeletedBy  = CurrentUser.Login;

            fileService.UpdateFile(file);

            return(new ActionResult()
            {
                Success = true,
                ActionType = action.ActionType
            });
        }