AppActs.API.Model.Crash.Crash.Add C# (CSharp) Method

Add() public method

public Add ( DeviceInfo deviceInfo, string lastScreen ) : void
deviceInfo AppActs.API.Model.Device.DeviceInfo
lastScreen string
return void
        public void Add(DeviceInfo deviceInfo, string lastScreen)
        {
            this.Model = deviceInfo.Model;
            this.OsVersion = deviceInfo.OperatingSystem;
            this.LastScreen = lastScreen;
            this.PlatformId = deviceInfo.PlatformType;
        }

Usage Example

        public void Log(Crash crash)
        {
            Application application = this.applicationRepository.Find(crash.ApplicationId);

            if (application != null)
            {
                DeviceInfo device = this.deviceRepository.Find(crash.DeviceId);

                if (device != null)
                {
                    string lastScreenBeforeCrash = null;
                    DeviceAppLastScreen appLastScreen =
                        this.eventRepository.GetDeviceAppLastScreenOneBy(crash.DeviceId, crash.ApplicationId);

                    if (appLastScreen != null)
                    {
                        lastScreenBeforeCrash = appLastScreen.ScreenName;
                    }

                    crash.Add(device, lastScreenBeforeCrash);

                    CrashSummary crashSummary = new CrashSummary(crash);

                    this.crashRepository.Save(crash);
                    this.crashRepository.Save(crashSummary);
                }
                else
                {
                    throw new NoDeviceException(crash.DeviceId);
                }
            }
            else
            {
                throw new InactiveApplicationException(crash.ApplicationId);
            }
        }