public ActionResult <VisitorDb> AddVisit([FromBody] VisitorDb info)
        {
            VisitorDb newVisit = new VisitorDb {
                FirstName     = info.FirstName,
                Surname       = info.Surname,
                Company       = info.Company,
                Role          = info.Role,
                Telephone     = info.Telephone,
                Email         = info.Email,
                EmployeeEmail = info.EmployeeEmail,
                Appointment   = info.Appointment,
            };

            _visitorContext.Visitor.Add(newVisit);
            _visitorContext.SaveChanges();

            return(Ok(new{ visit = newVisit }));
        }
Beispiel #2
0
        public ActionResult <ResponseModel> AddVisitor([FromBody] VisitorModel model)
        {
            var storageVisitor = Mapper.ConvertVisitorDomainModelToStorage(model);

            dbContext.Visitors.Add(storageVisitor);
            dbContext.SaveChanges();
            return(new ResponseModel {
                IsSuccess = true, Message = "Save Successful."
            });
        }
        public IActionResult Post([FromBody] Visitor visitor)
        {
            if (visitor == null)
            {
                return(BadRequest());
            }
            _context.Visitors.Add(visitor);
            _context.SaveChanges();

            return(Ok());
        }
Beispiel #4
0
 public ActionResult <Visitor> Poststring(Visitor visitor)
 {
     _visitorContext.Visitors.Add(visitor);
     _visitorContext.SaveChanges();
     return(visitor);
 }
Beispiel #5
0
 public ActionResult <User> Regist(User user)
 {
     ctx.Users.Add(user);
     ctx.SaveChanges();
     return(Ok(user));
 }
Beispiel #6
0
 public void Add(Visitor item)
 {
     _context.Visitors.Add(item);
     _context.SaveChanges();
 }