Exemplo n.º 1
0
        public ActionResult Create(Record record)
        {
            SetUser();
            record.Fk_UserId = _user.UserId;
            record.User      = _user;
            record.Exercise  = _repository.FindExercise((int)record.Fk_ExerciseId);

            if (ModelState.IsValid)
            {
                _repository.AddRecord(record);
                return(RedirectToAction("Get"));
            }

            return(View(record));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Result <Record> > > PostSecondaryCategory(Record record)
        {
            _recordRepository.AddRecord(record);
            await _recordRepository.SaveAsync();

            return(CreatedAtAction("GetRecord", new { id = record.RecordId }, record));
        }
Exemplo n.º 3
0
        public IActionResult Index(Record record)
        {
            _logger.LogInformation($"添加记录:{record.ToTxt()}");
            var dataResult  = _recordRepository.AddRecord(record);
            var emailResult = _emailRepository.SendEmail(record);

            if (!dataResult.Result)
            {
                _logger.LogError(dataResult.Message);
            }
            if (!emailResult.Result)
            {
                _logger.LogError(emailResult.Message);
            }
            if (dataResult.Result || emailResult.Result)
            {
                ViewBag.Message = "<span style='color:green'>関連情報を提出してくれてありがとう!</span>";
                return(View());
            }
            else
            {
                ViewBag.Message = $"<span style='color:red'>開催者に連絡してください。DataException:{dataResult.Message}  EmailException:{emailResult.Message}</span>";
                return(View());
            }
        }
Exemplo n.º 4
0
        public async Task <ActionResult> CreateRecord([FromBody] RecordDTO record, int boardId)
        {
            var newBoard = await _recordRepository.AddRecord(record, boardId);

            if (newBoard == null)
            {
                return(Conflict());
            }

            return(Ok(newBoard));
        }
Exemplo n.º 5
0
 public IActionResult Post([FromBody] string value)
 {
     try
     {
         var record = _recordParser.ParseRecord(value);
         _recordRepository.AddRecord(record);
         return(Created("GetSortedByGenderAscLastNameAsc", new RecordViewModel(record)));
     }
     catch (Exception exception)
     {
         return(BadRequest(exception.Message));
     }
 }
Exemplo n.º 6
0
        public void AddRecord(RecordDTO recordDTO)
        {
            if (recordDTO == null)
            {
                throw new ArgumentNullException();
            }

            var record = new Record
            {
                UserName   = recordDTO.UserName,
                UserRecord = recordDTO.UserRecord
            };

            _recordRepository.AddRecord(record);
        }
        public async Task <ActionResult <Record> > CreateRecord(Record record)
        {
            try
            {
                if (record == null)
                {
                    return(BadRequest());
                }

                var createdRecord = await recordRepository.AddRecord(record);

                return(CreatedAtAction(nameof(GetRecord), new { id = createdRecord.RecordId }, createdRecord));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Error to create record data "));
            }
        }
Exemplo n.º 8
0
        public async Task <IActionResult> AddRecord(RecordForAddEditDetails record)
        {
            if (record.Id > 0)
            {
                return(BadRequest("Record already exits"));
            }
            else if (await _patientRepo.GetPatient(record.PatientId, false) == null)
            {
                return(BadRequest("Patient does not exist"));
            }
            else
            {
                var newRecord = _repo.AddRecord(_mapper.Map <Record>(record)).Result;

                var patientToReturn = _mapper.Map <RecordForAddEditDetails>(newRecord);

                return(Ok(patientToReturn));
            }
        }
        public ActionResult Create(RecordFormViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("RecordForm", model));
            }

            var record = new Record
            {
                UserID      = User.Identity.GetUserId(),
                IsRevenue   = model.IsRevenue,
                Date        = model.Date,
                Charge      = model.Charge,
                Category    = model.Category,
                Subcategory = model.Subcategory,
                Name        = model.Name
            };

            _recordsRepository.AddRecord(record);
            _recordsRepository.Complete();

            TempData["message"] = string.Format("Zapisano {0} ", record.Name);
            return(RedirectToAction("RecordsList", "Records"));
        }
Exemplo n.º 10
0
 public void AddRecord(Record record)
 {
     recordRepo.AddRecord(record);
 }