// POST api/SPUser?JsonEmployee
        public void Post([FromBody] Employee e)
        {
            using (var ctx = new SPModel())
            {
                var employee = ctx.Set <Employee>();
                employee.Add(new Employee
                {
                    EmID       = e.EmID,
                    EmFname    = e.EmFname,
                    EmLname    = e.EmLname,
                    UserName   = e.UserName,
                    Password   = e.Password,
                    admin      = e.admin,
                    addJob     = e.addJob,
                    EditJob    = e.EditJob,
                    Department = e.Department,
                    SaleName   = e.SaleName,
                    CHK        = e.CHK,
                    DepID      = e.DepID,
                    stat       = e.stat,
                    Email      = e.Email
                });

                ctx.SaveChanges();
            }
        }
Beispiel #2
0
        // POST api/SPCalendar?JsonJob
        public void Post([FromBody] Job J)
        {
            using (var ctx = new SPModel())
            {
                var calendar = ctx.Set <Job>();
                calendar.Add(new Job
                {
                    JobID       = J.JobID,
                    JobDate     = J.JobDate,
                    CustFname   = J.CustFname,
                    CustLname   = J.CustLname,
                    JobType     = J.JobType,
                    JobCuft     = J.JobCuft,
                    TruckTrip   = J.TruckTrip,
                    Trip        = J.Trip,
                    EmID        = J.EmID,
                    JobStatus   = J.JobStatus,
                    Location    = J.Location,
                    Remark      = J.Remark,
                    Sale        = J.Sale,
                    Origin      = J.Origin,
                    Tel         = J.Tel,
                    StatusCon   = J.StatusCon,
                    JobRefNo    = J.JobRefNo,
                    ConId       = J.ConId,
                    VUnit       = J.VUnit,
                    TT1         = J.TT1,
                    TT2         = J.TT2,
                    TT3         = J.TT3,
                    TT4         = J.TT4,
                    TT5         = J.TT5,
                    TEAM        = J.TEAM,
                    CRTIME      = J.CRTIME,
                    CRNAME      = J.CRNAME,
                    TEAMCO      = J.TEAMCO,
                    TEAMNAME    = J.TEAMNAME,
                    Book1       = J.Book1,
                    Department1 = J.Department1,
                    Direction1  = J.Direction1,
                    Book2       = J.Book2,
                    Department2 = J.Department2,
                    Direction2  = J.Direction2,
                    Book3       = J.Book3,
                    Department3 = J.Department3,
                    Direction3  = J.Direction3,
                    TeamUnit    = J.TeamUnit,
                    InqId       = J.InqId,
                    AppointTime = J.AppointTime,
                    ComId       = J.ComId,
                    CusId       = J.CusId,
                    SJobRefNo   = J.SJobRefNo,
                    SConId      = J.SConId,
                    CusPhone    = J.CusPhone
                });

                ctx.SaveChanges();
            }
        }