using System; using System.Collections.Generic; using System.Linq; using System.Web; using Warehouse.Models.mesModel; using Z.EntityFramework.Plus; namespace Warehouse.DAL.Config.WorkOrderSequence { public class WorkOrderSequence { public interface IUnitOfWorks { } public seq_ctrl_wo_zx Query(string Workshop, string PlanDate) { using (var context = new mesModel()) { return context.seq_ctrl_wo_zx.FirstOrDefault(a => a.area_code == Workshop && a.plan_date == PlanDate); } } public int Update(string Workshop, string PlanDate, int Qty) { using (var context = new mesModel()) { //short Qty = (short)(context.seq_ctrl_wo_zx.Where(a => a.area_code == Workshop && a.plan_date == PlanDate).FirstOrDefault().seq_nbr + 1); return context.seq_ctrl_wo_zx.Where(a => a.area_code == Workshop && a.plan_date == PlanDate).Update(x => new seq_ctrl_wo_zx() { seq_nbr = (short)Qty }); } } public int Create(seq_ctrl_wo_zx Sequence) { using (var context = new mesModel()) { context.seq_ctrl_wo_zx.Add(Sequence); return context.SaveChanges(); } } } }