Ejemplo n.º 1
0
        public async Task <IActionResult> Edit([Bind("MachineCode,MachineName,MachineProdType,MachineSize,MachineRemark,CompanyCode,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_Machine m_Machine)
        {
            if (ModelState.IsValid)
            {
                m_Machine.Updated_By = await base.CurrentUserId();

                ResultObject resultObj;

                try
                {
                    using (var mcBll = new MachineBLL())
                    {
                        resultObj = await mcBll.UpdateMachine(m_Machine);

                        _cache.Remove("CACHE_MASTER_MACHINE");
                    }

                    return(Json(new { success = true, data = (M_Machine)resultObj.ObjectValue, message = "Machine Update." }));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, data = m_Machine, message = ex.Message }));
                }
            }

            var err = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList();

            return(Json(new { success = false, errors = err, data = m_Machine, message = "Update Failed" }));
        }
Ejemplo n.º 2
0
 public MachineLabelModel(M_Machine mc)
 {
     this.QR_CODE             = BitmapText(mc.MachineCode);
     this.Id                  = mc.Id;
     this.MachineCode         = mc.MachineCode;
     this.MachineName         = mc.MachineName;
     this.MachineProdType     = mc.MachineProdType;
     this.MachineProdTypeName = mc.MachineProdTypeName;
     this.MachineSize         = mc.MachineSize;
     this.MachineRemark       = mc.MachineRemark;
     this.CompanyCode         = mc.CompanyCode;
     this.Is_Active           = mc.Is_Active;
     this.Created_By          = mc.Created_By;
     this.Created_Date        = mc.Created_Date;
     this.Updated_By          = mc.Updated_By;
     this.Updated_Date        = mc.Updated_Date;
 }