コード例 #1
0
        public IActionResult PostItem(ItemRequestDto request)
        {
            try
            {
                Item item = new Item();
                item.User_Initials = request.InitialFirst + request.InitialSecond + request.InitialThird;
                item.Material      = request.Material;
                item.Size          = request.Size;
                item.User_FullName = request.User_FullName;

                databaseContext.Items.Add(item);
                databaseContext.SaveChanges();

                return(Ok(new DtoOutput <int>(true, "Successfully saved your item choice!")));
            }
            catch
            {
                return(Ok(new DtoOutput <int>(false, "Something went wrong! Please try again.")));
            }
        }
コード例 #2
0
        public ItemRequestForm(string mode, DataGridViewRow row)
        {
            InitializeComponent();
            _Context        = new PurchaseContext();
            itemRequestRepo = new ItemRequestRepository();
            item            = new ItemRequestDto();

            if (mode != null)
            {
                this.mode = mode;

                if (this.mode.Equals("Create"))
                {
                    Text = "Crear Solicitud de Articulo";
                }

                if (this.mode.Equals("Edit"))
                {
                    Text     = "Editar Solicitud de Articulo";
                    this.row = row;
                }
            }
        }